##// END OF EJS Templates
Fix Y range when displaying a uninitialized var in a graph
trabillard -
r1289:3b077ff20668
parent child
Show More
@@ -310,12 +310,13 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable, S
310 // Calls update of graph's range and units when the data of the variable have been initialized.
310 // Calls update of graph's range and units when the data of the variable have been initialized.
311 // Note: we use QueuedConnection here as the update event must be called in the UI thread
311 // Note: we use QueuedConnection here as the update event must be called in the UI thread
312 connect(variable.get(), &Variable::dataInitialized, this,
312 connect(variable.get(), &Variable::dataInitialized, this,
313 [ varW = std::weak_ptr<Variable>{variable}, range, loadRange ]() {
313 [ varW = std::weak_ptr<Variable>{variable}, range, loadRange, this ]() {
314 if (auto var = varW.lock()) {
314 if (auto var = varW.lock()) {
315 // If the variable is the first added in the graph, we load its range
315 // If the variable is the first added in the graph, we load its range
316 auto firstVariableInGraph = range == INVALID_RANGE;
316 auto firstVariableInGraph = range == INVALID_RANGE;
317 auto loadedRange = firstVariableInGraph ? var->range() : range;
317 auto loadedRange = firstVariableInGraph ? var->range() : range;
318 loadRange(var, loadedRange);
318 loadRange(var, loadedRange);
319 setYRange(var);
319 }
320 }
320 },
321 },
321 Qt::QueuedConnection);
322 Qt::QueuedConnection);
General Comments 0
You need to be logged in to leave comments. Login now