##// END OF EJS Templates
Implements VisualizationWidget::displayVariable() slot
Alexandre Leroux -
r163:a33df991d7dc
parent child
Show More
@@ -1,5 +1,7
1 1 #include "Visualization/VisualizationWidget.h"
2 #include "Visualization/VisualizationGraphWidget.h"
2 3 #include "Visualization/VisualizationTabWidget.h"
4 #include "Visualization/VisualizationZoneWidget.h"
3 5 #include "Visualization/qcustomplot.h"
4 6
5 7 #include "ui_VisualizationWidget.h"
@@ -81,5 +83,23 QString VisualizationWidget::name() const
81 83
82 84 void VisualizationWidget::displayVariable(std::shared_ptr<Variable> variable) noexcept
83 85 {
84 /// @todo ALX : add variable in a new graph
86 if (auto currentTab = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->currentWidget())) {
87 if (auto newZone = currentTab->createZone()) {
88 if (auto newGraph = newZone->createGraph()) {
89 newGraph->addVariable(variable);
90 }
91 else {
92 qCDebug(LOG_VisualizationWidget())
93 << tr("Can't display the variable : can't create the graph");
94 }
95 }
96 else {
97 qCDebug(LOG_VisualizationWidget())
98 << tr("Can't display the variable : can't create a new zone in the current tab");
99 }
100 }
101 else {
102 qCDebug(LOG_VisualizationWidget())
103 << tr("Can't display the variable : there is no current tab");
104 }
85 105 }
General Comments 0
You need to be logged in to leave comments. Login now