##// END OF EJS Templates
New class to manage actions in the visualization
trabillard -
r1113:e77848f95b30
parent child
Show More
@@ -0,0 +1,12
1 #ifndef SCIQLOP_VISUALIZATIONACTIONMANAGER_H
2 #define SCIQLOP_VISUALIZATIONACTIONMANAGER_H
3
4
5 class VisualizationActionManager {
6 public:
7 VisualizationActionManager();
8
9 void installSelectionZoneActions();
10 };
11
12 #endif // SCIQLOP_VISUALIZATIONACTIONMANAGER_H
@@ -0,0 +1,14
1 #include "Visualization/VisualizationActionManager.h"
2
3 #include <Actions/ActionsGuiController.h>
4 #include <SqpApplication.h>
5
6 VisualizationActionManager::VisualizationActionManager() {}
7
8 void VisualizationActionManager::installSelectionZoneActions()
9 {
10 auto &actionController = sqpApp->actionsGuiController();
11 actionController.addSectionZoneAction("Remove Selected Zone(s)", [](auto &zone) {});
12 actionController.addSectionZoneAction("Align Left", [](auto &zone) {});
13 actionController.addSectionZoneAction("Align Right", [](auto &zone) {});
14 }
@@ -1,106 +1,107
1
1
2 gui_moc_headers = [
2 gui_moc_headers = [
3 'include/DataSource/DataSourceWidget.h',
3 'include/DataSource/DataSourceWidget.h',
4 'include/Settings/SqpSettingsDialog.h',
4 'include/Settings/SqpSettingsDialog.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
5 'include/Settings/SqpSettingsGeneralWidget.h',
6 'include/SidePane/SqpSidePane.h',
6 'include/SidePane/SqpSidePane.h',
7 'include/SqpApplication.h',
7 'include/SqpApplication.h',
8 'include/DragAndDrop/DragDropScroller.h',
8 'include/DragAndDrop/DragDropScroller.h',
9 'include/DragAndDrop/DragDropTabSwitcher.h',
9 'include/DragAndDrop/DragDropTabSwitcher.h',
10 'include/TimeWidget/TimeWidget.h',
10 'include/TimeWidget/TimeWidget.h',
11 'include/Variable/VariableInspectorWidget.h',
11 'include/Variable/VariableInspectorWidget.h',
12 'include/Variable/RenameVariableDialog.h',
12 'include/Variable/RenameVariableDialog.h',
13 'include/Visualization/qcustomplot.h',
13 'include/Visualization/qcustomplot.h',
14 'include/Visualization/VisualizationGraphWidget.h',
14 'include/Visualization/VisualizationGraphWidget.h',
15 'include/Visualization/VisualizationTabWidget.h',
15 'include/Visualization/VisualizationTabWidget.h',
16 'include/Visualization/VisualizationWidget.h',
16 'include/Visualization/VisualizationWidget.h',
17 'include/Visualization/VisualizationZoneWidget.h',
17 'include/Visualization/VisualizationZoneWidget.h',
18 'include/Visualization/VisualizationDragDropContainer.h',
18 'include/Visualization/VisualizationDragDropContainer.h',
19 'include/Visualization/VisualizationDragWidget.h',
19 'include/Visualization/VisualizationDragWidget.h',
20 'include/Visualization/ColorScaleEditor.h',
20 'include/Visualization/ColorScaleEditor.h',
21 'include/Visualization/SelectionZoneAction.h'
21 'include/Visualization/SelectionZoneAction.h'
22 ]
22 ]
23
23
24 gui_ui_files = [
24 gui_ui_files = [
25 'ui/DataSource/DataSourceWidget.ui',
25 'ui/DataSource/DataSourceWidget.ui',
26 'ui/Settings/SqpSettingsDialog.ui',
26 'ui/Settings/SqpSettingsDialog.ui',
27 'ui/Settings/SqpSettingsGeneralWidget.ui',
27 'ui/Settings/SqpSettingsGeneralWidget.ui',
28 'ui/SidePane/SqpSidePane.ui',
28 'ui/SidePane/SqpSidePane.ui',
29 'ui/TimeWidget/TimeWidget.ui',
29 'ui/TimeWidget/TimeWidget.ui',
30 'ui/Variable/VariableInspectorWidget.ui',
30 'ui/Variable/VariableInspectorWidget.ui',
31 'ui/Variable/RenameVariableDialog.ui',
31 'ui/Variable/RenameVariableDialog.ui',
32 'ui/Variable/VariableMenuHeaderWidget.ui',
32 'ui/Variable/VariableMenuHeaderWidget.ui',
33 'ui/Visualization/VisualizationGraphWidget.ui',
33 'ui/Visualization/VisualizationGraphWidget.ui',
34 'ui/Visualization/VisualizationTabWidget.ui',
34 'ui/Visualization/VisualizationTabWidget.ui',
35 'ui/Visualization/VisualizationWidget.ui',
35 'ui/Visualization/VisualizationWidget.ui',
36 'ui/Visualization/VisualizationZoneWidget.ui',
36 'ui/Visualization/VisualizationZoneWidget.ui',
37 'ui/Visualization/ColorScaleEditor.ui'
37 'ui/Visualization/ColorScaleEditor.ui'
38 ]
38 ]
39
39
40 gui_qresources = ['resources/sqpguiresources.qrc']
40 gui_qresources = ['resources/sqpguiresources.qrc']
41
41
42 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
42 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
43 ui_files : gui_ui_files,
43 ui_files : gui_ui_files,
44 qresources : gui_qresources)
44 qresources : gui_qresources)
45
45
46 gui_sources = [
46 gui_sources = [
47 'src/SqpApplication.cpp',
47 'src/SqpApplication.cpp',
48 'src/DragAndDrop/DragDropHelper.cpp',
48 'src/DragAndDrop/DragDropHelper.cpp',
49 'src/DragAndDrop/DragDropScroller.cpp',
49 'src/DragAndDrop/DragDropScroller.cpp',
50 'src/DragAndDrop/DragDropTabSwitcher.cpp',
50 'src/DragAndDrop/DragDropTabSwitcher.cpp',
51 'src/Common/ColorUtils.cpp',
51 'src/Common/ColorUtils.cpp',
52 'src/Common/VisualizationDef.cpp',
52 'src/Common/VisualizationDef.cpp',
53 'src/DataSource/DataSourceTreeWidgetItem.cpp',
53 'src/DataSource/DataSourceTreeWidgetItem.cpp',
54 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
54 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
55 'src/DataSource/DataSourceWidget.cpp',
55 'src/DataSource/DataSourceWidget.cpp',
56 'src/DataSource/DataSourceTreeWidget.cpp',
56 'src/DataSource/DataSourceTreeWidget.cpp',
57 'src/Settings/SqpSettingsDialog.cpp',
57 'src/Settings/SqpSettingsDialog.cpp',
58 'src/Settings/SqpSettingsGeneralWidget.cpp',
58 'src/Settings/SqpSettingsGeneralWidget.cpp',
59 'src/SidePane/SqpSidePane.cpp',
59 'src/SidePane/SqpSidePane.cpp',
60 'src/TimeWidget/TimeWidget.cpp',
60 'src/TimeWidget/TimeWidget.cpp',
61 'src/Variable/VariableInspectorWidget.cpp',
61 'src/Variable/VariableInspectorWidget.cpp',
62 'src/Variable/VariableInspectorTableView.cpp',
62 'src/Variable/VariableInspectorTableView.cpp',
63 'src/Variable/VariableMenuHeaderWidget.cpp',
63 'src/Variable/VariableMenuHeaderWidget.cpp',
64 'src/Variable/RenameVariableDialog.cpp',
64 'src/Variable/RenameVariableDialog.cpp',
65 'src/Visualization/VisualizationGraphHelper.cpp',
65 'src/Visualization/VisualizationGraphHelper.cpp',
66 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
66 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
67 'src/Visualization/VisualizationGraphWidget.cpp',
67 'src/Visualization/VisualizationGraphWidget.cpp',
68 'src/Visualization/VisualizationTabWidget.cpp',
68 'src/Visualization/VisualizationTabWidget.cpp',
69 'src/Visualization/VisualizationWidget.cpp',
69 'src/Visualization/VisualizationWidget.cpp',
70 'src/Visualization/VisualizationZoneWidget.cpp',
70 'src/Visualization/VisualizationZoneWidget.cpp',
71 'src/Visualization/qcustomplot.cpp',
71 'src/Visualization/qcustomplot.cpp',
72 'src/Visualization/QCustomPlotSynchronizer.cpp',
72 'src/Visualization/QCustomPlotSynchronizer.cpp',
73 'src/Visualization/operations/FindVariableOperation.cpp',
73 'src/Visualization/operations/FindVariableOperation.cpp',
74 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
74 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
75 'src/Visualization/operations/MenuBuilder.cpp',
75 'src/Visualization/operations/MenuBuilder.cpp',
76 'src/Visualization/operations/RemoveVariableOperation.cpp',
76 'src/Visualization/operations/RemoveVariableOperation.cpp',
77 'src/Visualization/operations/RescaleAxeOperation.cpp',
77 'src/Visualization/operations/RescaleAxeOperation.cpp',
78 'src/Visualization/VisualizationDragDropContainer.cpp',
78 'src/Visualization/VisualizationDragDropContainer.cpp',
79 'src/Visualization/VisualizationDragWidget.cpp',
79 'src/Visualization/VisualizationDragWidget.cpp',
80 'src/Visualization/AxisRenderingUtils.cpp',
80 'src/Visualization/AxisRenderingUtils.cpp',
81 'src/Visualization/PlottablesRenderingUtils.cpp',
81 'src/Visualization/PlottablesRenderingUtils.cpp',
82 'src/Visualization/MacScrollBarStyle.cpp',
82 'src/Visualization/MacScrollBarStyle.cpp',
83 'src/Visualization/VisualizationCursorItem.cpp',
83 'src/Visualization/VisualizationCursorItem.cpp',
84 'src/Visualization/ColorScaleEditor.cpp',
84 'src/Visualization/ColorScaleEditor.cpp',
85 'src/Visualization/SqpColorScale.cpp',
85 'src/Visualization/SqpColorScale.cpp',
86 'src/Visualization/QCPColorMapIterator.cpp',
86 'src/Visualization/QCPColorMapIterator.cpp',
87 'src/Visualization/VisualizationSelectionZoneItem.cpp',
87 'src/Visualization/VisualizationSelectionZoneItem.cpp',
88 'src/Visualization/VisualizationSelectionZoneManager.cpp',
88 'src/Visualization/VisualizationSelectionZoneManager.cpp',
89 'src/Visualization/SelectionZoneAction.cpp',
89 'src/Visualization/SelectionZoneAction.cpp',
90 'src/Visualization/ActionsGuiController.cpp'
90 'src/Visualization/ActionsGuiController.cpp',
91 'src/Visualization/VisualizationActionManager.cpp'
91 ]
92 ]
92
93
93 gui_inc = include_directories(['include'])
94 gui_inc = include_directories(['include'])
94
95
95 sciqlop_gui_lib = library('sciqlopgui',
96 sciqlop_gui_lib = library('sciqlopgui',
96 gui_sources,
97 gui_sources,
97 gui_moc_files,
98 gui_moc_files,
98 include_directories : [gui_inc],
99 include_directories : [gui_inc],
99 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
100 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
100 install : true
101 install : true
101 )
102 )
102
103
103 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
104 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
104 include_directories : gui_inc,
105 include_directories : gui_inc,
105 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
106 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
106
107
@@ -1,197 +1,201
1 #include "Visualization/VisualizationWidget.h"
1 #include "Visualization/VisualizationWidget.h"
2 #include "Visualization/IVisualizationWidgetVisitor.h"
2 #include "Visualization/IVisualizationWidgetVisitor.h"
3 #include "Visualization/VisualizationActionManager.h"
3 #include "Visualization/VisualizationGraphWidget.h"
4 #include "Visualization/VisualizationGraphWidget.h"
4 #include "Visualization/VisualizationSelectionZoneManager.h"
5 #include "Visualization/VisualizationSelectionZoneManager.h"
5 #include "Visualization/VisualizationTabWidget.h"
6 #include "Visualization/VisualizationTabWidget.h"
6 #include "Visualization/VisualizationZoneWidget.h"
7 #include "Visualization/VisualizationZoneWidget.h"
7 #include "Visualization/operations/FindVariableOperation.h"
8 #include "Visualization/operations/FindVariableOperation.h"
8 #include "Visualization/operations/GenerateVariableMenuOperation.h"
9 #include "Visualization/operations/GenerateVariableMenuOperation.h"
9 #include "Visualization/operations/RemoveVariableOperation.h"
10 #include "Visualization/operations/RemoveVariableOperation.h"
10 #include "Visualization/operations/RescaleAxeOperation.h"
11 #include "Visualization/operations/RescaleAxeOperation.h"
11 #include "Visualization/qcustomplot.h"
12 #include "Visualization/qcustomplot.h"
12
13
13 #include "ui_VisualizationWidget.h"
14 #include "ui_VisualizationWidget.h"
14
15
15 #include "DragAndDrop/DragDropGuiController.h"
16 #include "DragAndDrop/DragDropGuiController.h"
16 #include "SqpApplication.h"
17 #include "SqpApplication.h"
17
18
18 #include <QToolButton>
19 #include <QToolButton>
19
20
20 #include <memory>
21 #include <memory>
21
22
22 Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget")
23 Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget")
23
24
24 struct VisualizationWidget::VisualizationWidgetPrivate {
25 struct VisualizationWidget::VisualizationWidgetPrivate {
25 std::unique_ptr<VisualizationSelectionZoneManager> m_ZoneSelectionManager = nullptr;
26 std::unique_ptr<VisualizationSelectionZoneManager> m_ZoneSelectionManager = nullptr;
27 VisualizationActionManager m_ActionManager;
26
28
27 VisualizationWidgetPrivate()
29 VisualizationWidgetPrivate()
28 : m_ZoneSelectionManager(std::make_unique<VisualizationSelectionZoneManager>())
30 : m_ZoneSelectionManager(std::make_unique<VisualizationSelectionZoneManager>())
29 {
31 {
30 }
32 }
31 };
33 };
32
34
33 VisualizationWidget::VisualizationWidget(QWidget *parent)
35 VisualizationWidget::VisualizationWidget(QWidget *parent)
34 : QWidget{parent},
36 : QWidget{parent},
35 ui{new Ui::VisualizationWidget},
37 ui{new Ui::VisualizationWidget},
36 impl{spimpl::make_unique_impl<VisualizationWidgetPrivate>()}
38 impl{spimpl::make_unique_impl<VisualizationWidgetPrivate>()}
37 {
39 {
38 ui->setupUi(this);
40 ui->setupUi(this);
39
41
40 auto addTabViewButton = new QToolButton{ui->tabWidget};
42 auto addTabViewButton = new QToolButton{ui->tabWidget};
41 addTabViewButton->setText(tr("Add View"));
43 addTabViewButton->setText(tr("Add View"));
42 addTabViewButton->setCursor(Qt::ArrowCursor);
44 addTabViewButton->setCursor(Qt::ArrowCursor);
43 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
45 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
44
46
45 auto enableMinimumCornerWidgetSize = [this](bool enable) {
47 auto enableMinimumCornerWidgetSize = [this](bool enable) {
46
48
47 auto tabViewCornerWidget = ui->tabWidget->cornerWidget();
49 auto tabViewCornerWidget = ui->tabWidget->cornerWidget();
48 auto width = enable ? tabViewCornerWidget->width() : 0;
50 auto width = enable ? tabViewCornerWidget->width() : 0;
49 auto height = enable ? tabViewCornerWidget->height() : 0;
51 auto height = enable ? tabViewCornerWidget->height() : 0;
50 tabViewCornerWidget->setMinimumHeight(height);
52 tabViewCornerWidget->setMinimumHeight(height);
51 tabViewCornerWidget->setMinimumWidth(width);
53 tabViewCornerWidget->setMinimumWidth(width);
52 ui->tabWidget->setMinimumHeight(height);
54 ui->tabWidget->setMinimumHeight(height);
53 ui->tabWidget->setMinimumWidth(width);
55 ui->tabWidget->setMinimumWidth(width);
54 };
56 };
55
57
56 auto addTabView = [this, enableMinimumCornerWidgetSize]() {
58 auto addTabView = [this, enableMinimumCornerWidgetSize]() {
57 auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1),
59 auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1),
58 ui->tabWidget};
60 ui->tabWidget};
59 auto index = ui->tabWidget->addTab(widget, widget->name());
61 auto index = ui->tabWidget->addTab(widget, widget->name());
60 if (ui->tabWidget->count() > 0) {
62 if (ui->tabWidget->count() > 0) {
61 enableMinimumCornerWidgetSize(false);
63 enableMinimumCornerWidgetSize(false);
62 }
64 }
63 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
65 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
64 };
66 };
65
67
66 auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) {
68 auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) {
67 if (ui->tabWidget->count() == 1) {
69 if (ui->tabWidget->count() == 1) {
68 enableMinimumCornerWidgetSize(true);
70 enableMinimumCornerWidgetSize(true);
69 }
71 }
70
72
71 // Removes widget from tab and closes it
73 // Removes widget from tab and closes it
72 auto widget = ui->tabWidget->widget(index);
74 auto widget = ui->tabWidget->widget(index);
73 ui->tabWidget->removeTab(index);
75 ui->tabWidget->removeTab(index);
74 if (widget) {
76 if (widget) {
75 widget->close();
77 widget->close();
76 }
78 }
77
79
78 qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index);
80 qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index);
79
81
80 };
82 };
81
83
82 ui->tabWidget->setTabsClosable(true);
84 ui->tabWidget->setTabsClosable(true);
83
85
84 connect(addTabViewButton, &QToolButton::clicked, addTabView);
86 connect(addTabViewButton, &QToolButton::clicked, addTabView);
85 connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView);
87 connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView);
86
88
87 sqpApp->dragDropGuiController().addDragDropTabBar(ui->tabWidget->tabBar());
89 sqpApp->dragDropGuiController().addDragDropTabBar(ui->tabWidget->tabBar());
88
90
91 impl->m_ActionManager.installSelectionZoneActions();
92
89 // Adds default tab
93 // Adds default tab
90 addTabView();
94 addTabView();
91 }
95 }
92
96
93 VisualizationWidget::~VisualizationWidget()
97 VisualizationWidget::~VisualizationWidget()
94 {
98 {
95 sqpApp->dragDropGuiController().removeDragDropTabBar(ui->tabWidget->tabBar());
99 sqpApp->dragDropGuiController().removeDragDropTabBar(ui->tabWidget->tabBar());
96 delete ui;
100 delete ui;
97 }
101 }
98
102
99 VisualizationSelectionZoneManager &VisualizationWidget::selectionZoneManager() const
103 VisualizationSelectionZoneManager &VisualizationWidget::selectionZoneManager() const
100 {
104 {
101 return *impl->m_ZoneSelectionManager.get();
105 return *impl->m_ZoneSelectionManager.get();
102 }
106 }
103
107
104 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
108 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
105 {
109 {
106 if (visitor) {
110 if (visitor) {
107 visitor->visitEnter(this);
111 visitor->visitEnter(this);
108
112
109 // Apply visitor for tab children
113 // Apply visitor for tab children
110 for (auto i = 0; i < ui->tabWidget->count(); ++i) {
114 for (auto i = 0; i < ui->tabWidget->count(); ++i) {
111 // Widgets different from tabs are not visited (no action)
115 // Widgets different from tabs are not visited (no action)
112 if (auto visualizationTabWidget
116 if (auto visualizationTabWidget
113 = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) {
117 = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) {
114 visualizationTabWidget->accept(visitor);
118 visualizationTabWidget->accept(visitor);
115 }
119 }
116 }
120 }
117
121
118 visitor->visitLeave(this);
122 visitor->visitLeave(this);
119 }
123 }
120 else {
124 else {
121 qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null");
125 qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null");
122 }
126 }
123 }
127 }
124
128
125 bool VisualizationWidget::canDrop(const Variable &variable) const
129 bool VisualizationWidget::canDrop(const Variable &variable) const
126 {
130 {
127 // The main widget can never accomodate a variable
131 // The main widget can never accomodate a variable
128 Q_UNUSED(variable);
132 Q_UNUSED(variable);
129 return false;
133 return false;
130 }
134 }
131
135
132 bool VisualizationWidget::contains(const Variable &variable) const
136 bool VisualizationWidget::contains(const Variable &variable) const
133 {
137 {
134 Q_UNUSED(variable);
138 Q_UNUSED(variable);
135 return false;
139 return false;
136 }
140 }
137
141
138 QString VisualizationWidget::name() const
142 QString VisualizationWidget::name() const
139 {
143 {
140 return QStringLiteral("MainView");
144 return QStringLiteral("MainView");
141 }
145 }
142
146
143 void VisualizationWidget::attachVariableMenu(
147 void VisualizationWidget::attachVariableMenu(
144 QMenu *menu, const QVector<std::shared_ptr<Variable> > &variables) noexcept
148 QMenu *menu, const QVector<std::shared_ptr<Variable> > &variables) noexcept
145 {
149 {
146 // Menu is generated only if there is a single variable
150 // Menu is generated only if there is a single variable
147 if (variables.size() == 1) {
151 if (variables.size() == 1) {
148 if (auto variable = variables.first()) {
152 if (auto variable = variables.first()) {
149 // Gets the containers of the variable
153 // Gets the containers of the variable
150 FindVariableOperation findVariableOperation{variable};
154 FindVariableOperation findVariableOperation{variable};
151 accept(&findVariableOperation);
155 accept(&findVariableOperation);
152 auto variableContainers = findVariableOperation.result();
156 auto variableContainers = findVariableOperation.result();
153
157
154 // Generates the actions that make it possible to visualize the variable
158 // Generates the actions that make it possible to visualize the variable
155 GenerateVariableMenuOperation generateVariableMenuOperation{
159 GenerateVariableMenuOperation generateVariableMenuOperation{
156 menu, variable, std::move(variableContainers)};
160 menu, variable, std::move(variableContainers)};
157 accept(&generateVariableMenuOperation);
161 accept(&generateVariableMenuOperation);
158 }
162 }
159 else {
163 else {
160 qCCritical(LOG_VisualizationWidget()) << tr(
164 qCCritical(LOG_VisualizationWidget()) << tr(
161 "Can't generate the menu relative to the visualization: the variable is null");
165 "Can't generate the menu relative to the visualization: the variable is null");
162 }
166 }
163 }
167 }
164 else {
168 else {
165 qCDebug(LOG_VisualizationWidget())
169 qCDebug(LOG_VisualizationWidget())
166 << tr("No generation of the menu related to the visualization: several variables are "
170 << tr("No generation of the menu related to the visualization: several variables are "
167 "selected");
171 "selected");
168 }
172 }
169 }
173 }
170
174
171 void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept
175 void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept
172 {
176 {
173 // Calls the operation of removing all references to the variable in the visualization
177 // Calls the operation of removing all references to the variable in the visualization
174 auto removeVariableOperation = RemoveVariableOperation{variable};
178 auto removeVariableOperation = RemoveVariableOperation{variable};
175 accept(&removeVariableOperation);
179 accept(&removeVariableOperation);
176 }
180 }
177
181
178 void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable,
182 void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable,
179 const SqpRange &range) noexcept
183 const SqpRange &range) noexcept
180 {
184 {
181 // Calls the operation of rescaling all graph that contrains variable in the visualization
185 // Calls the operation of rescaling all graph that contrains variable in the visualization
182 auto rescaleVariableOperation = RescaleAxeOperation{variable, range};
186 auto rescaleVariableOperation = RescaleAxeOperation{variable, range};
183 accept(&rescaleVariableOperation);
187 accept(&rescaleVariableOperation);
184 }
188 }
185
189
186 void VisualizationWidget::closeEvent(QCloseEvent *event)
190 void VisualizationWidget::closeEvent(QCloseEvent *event)
187 {
191 {
188 // Closes tabs in the widget
192 // Closes tabs in the widget
189 for (auto i = 0; i < ui->tabWidget->count(); ++i) {
193 for (auto i = 0; i < ui->tabWidget->count(); ++i) {
190 if (auto visualizationTabWidget
194 if (auto visualizationTabWidget
191 = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) {
195 = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) {
192 visualizationTabWidget->close();
196 visualizationTabWidget->close();
193 }
197 }
194 }
198 }
195
199
196 QWidget::closeEvent(event);
200 QWidget::closeEvent(event);
197 }
201 }
General Comments 4
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

Approved

Status change > Approved

You need to be logged in to leave comments. Login now