@@ -8,6 +8,7 | |||
|
8 | 8 | |
|
9 | 9 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) |
|
10 | 10 | |
|
11 | class QMenu; | |
|
11 | 12 | class Variable; |
|
12 | 13 | class VisualizationTabWidget; |
|
13 | 14 | |
@@ -39,12 +40,11 public: | |||
|
39 | 40 | |
|
40 | 41 | public slots: |
|
41 | 42 | /** |
|
42 | * Displays a variable in a new graph of a new zone of the current tab | |
|
43 | * @param variable the variable to display | |
|
44 | * @todo this is a temporary method that will be replaced by own actions for each type of | |
|
45 | * visualization widget | |
|
43 | * Attaches to a menu the menu relating to the visualization of a variable | |
|
44 | * @param menu the parent menu of the generated menu | |
|
45 | * @param variable the variable for which to generate the menu | |
|
46 | 46 | */ |
|
47 |
void |
|
|
47 | void attachVariableMenu(QMenu *menu, std::shared_ptr<Variable> variable) noexcept; | |
|
48 | 48 | |
|
49 | 49 | private: |
|
50 | 50 | Ui::VisualizationWidget *ui; |
@@ -3,6 +3,7 | |||
|
3 | 3 | #include "Visualization/VisualizationGraphWidget.h" |
|
4 | 4 | #include "Visualization/VisualizationTabWidget.h" |
|
5 | 5 | #include "Visualization/VisualizationZoneWidget.h" |
|
6 | #include "Visualization/operations/GenerateVariableMenuOperation.h" | |
|
6 | 7 | #include "Visualization/qcustomplot.h" |
|
7 | 8 | |
|
8 | 9 | #include "ui_VisualizationWidget.h" |
@@ -121,16 +122,10 QString VisualizationWidget::name() const | |||
|
121 | 122 | return QStringLiteral("MainView"); |
|
122 | 123 | } |
|
123 | 124 | |
|
124 | void VisualizationWidget::displayVariable(std::shared_ptr<Variable> variable) noexcept | |
|
125 | void VisualizationWidget::attachVariableMenu(QMenu *menu, | |
|
126 | std::shared_ptr<Variable> variable) noexcept | |
|
125 | 127 | { |
|
126 | if (auto currentTab = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->currentWidget())) { | |
|
127 | if (!currentTab->createZone(variable)) { | |
|
128 | qCCritical(LOG_VisualizationWidget()) | |
|
129 | << tr("Can't display the variable : can't create a new zone in the current tab"); | |
|
130 | } | |
|
131 | } | |
|
132 | else { | |
|
133 | qCCritical(LOG_VisualizationWidget()) | |
|
134 | << tr("Can't display the variable : there is no current tab"); | |
|
135 | } | |
|
128 | // Generates the actions that make it possible to visualize the variable | |
|
129 | auto generateVariableMenuOperation = GenerateVariableMenuOperation{menu, variable}; | |
|
130 | accept(&generateVariableMenuOperation); | |
|
136 | 131 | } |
General Comments 0
You need to be logged in to leave comments.
Login now