##// END OF EJS Templates
Unplot menu (4): handles 'Unplot' menu when leaving a tab or a zone...
Alexandre Leroux -
r300:f83820cc7288
parent child
Show More
@@ -40,8 +40,8 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
40 }
40 }
41
41
42 template <typename ActionFun>
42 template <typename ActionFun>
43 void visitNodeLeave(const IVisualizationWidget &container, const QString &actionName,
43 void visitNodeLeavePlot(const IVisualizationWidget &container, const QString &actionName,
44 ActionFun actionFunction)
44 ActionFun actionFunction)
45 {
45 {
46 if (m_Variable && container.canDrop(*m_Variable)) {
46 if (m_Variable && container.canDrop(*m_Variable)) {
47 m_PlotMenuBuilder.addSeparator();
47 m_PlotMenuBuilder.addSeparator();
@@ -52,6 +52,12 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
52 m_PlotMenuBuilder.closeMenu();
52 m_PlotMenuBuilder.closeMenu();
53 }
53 }
54
54
55 void visitNodeLeaveUnplot()
56 {
57 // Closes the menu associated to the node
58 m_UnplotMenuBuilder.closeMenu();
59 }
60
55 template <typename ActionFun>
61 template <typename ActionFun>
56 void visitLeaf(const IVisualizationWidget &container, const QString &actionName,
62 void visitLeaf(const IVisualizationWidget &container, const QString &actionName,
57 ActionFun actionFunction)
63 ActionFun actionFunction)
@@ -105,9 +111,13 void GenerateVariableMenuOperation::visitEnter(VisualizationTabWidget *tabWidget
105 void GenerateVariableMenuOperation::visitLeave(VisualizationTabWidget *tabWidget)
111 void GenerateVariableMenuOperation::visitLeave(VisualizationTabWidget *tabWidget)
106 {
112 {
107 if (tabWidget) {
113 if (tabWidget) {
108 impl->visitNodeLeave(
114 // 'Plot' menu
115 impl->visitNodeLeavePlot(
109 *tabWidget, QObject::tr("Open in a new zone"),
116 *tabWidget, QObject::tr("Open in a new zone"),
110 [ var = impl->m_Variable, tabWidget ]() { tabWidget->createZone(var); });
117 [ var = impl->m_Variable, tabWidget ]() { tabWidget->createZone(var); });
118
119 // 'Unplot' menu
120 impl->visitNodeLeaveUnplot();
111 }
121 }
112 else {
122 else {
113 qCCritical(LOG_GenerateVariableMenuOperation(),
123 qCCritical(LOG_GenerateVariableMenuOperation(),
@@ -130,9 +140,13 void GenerateVariableMenuOperation::visitEnter(VisualizationZoneWidget *zoneWidg
130 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidget)
140 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidget)
131 {
141 {
132 if (zoneWidget) {
142 if (zoneWidget) {
133 impl->visitNodeLeave(
143 // 'Plot' menu
144 impl->visitNodeLeavePlot(
134 *zoneWidget, QObject::tr("Open in a new graph"),
145 *zoneWidget, QObject::tr("Open in a new graph"),
135 [ var = impl->m_Variable, zoneWidget ]() { zoneWidget->createGraph(var); });
146 [ var = impl->m_Variable, zoneWidget ]() { zoneWidget->createGraph(var); });
147
148 // 'Unplot' menu
149 impl->visitNodeLeaveUnplot();
136 }
150 }
137 else {
151 else {
138 qCCritical(LOG_GenerateVariableMenuOperation(),
152 qCCritical(LOG_GenerateVariableMenuOperation(),
General Comments 0
You need to be logged in to leave comments. Login now