##// 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 42 template <typename ActionFun>
43 void visitNodeLeave(const IVisualizationWidget &container, const QString &actionName,
44 ActionFun actionFunction)
43 void visitNodeLeavePlot(const IVisualizationWidget &container, const QString &actionName,
44 ActionFun actionFunction)
45 45 {
46 46 if (m_Variable && container.canDrop(*m_Variable)) {
47 47 m_PlotMenuBuilder.addSeparator();
@@ -52,6 +52,12 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
52 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 61 template <typename ActionFun>
56 62 void visitLeaf(const IVisualizationWidget &container, const QString &actionName,
57 63 ActionFun actionFunction)
@@ -105,9 +111,13 void GenerateVariableMenuOperation::visitEnter(VisualizationTabWidget *tabWidget
105 111 void GenerateVariableMenuOperation::visitLeave(VisualizationTabWidget *tabWidget)
106 112 {
107 113 if (tabWidget) {
108 impl->visitNodeLeave(
114 // 'Plot' menu
115 impl->visitNodeLeavePlot(
109 116 *tabWidget, QObject::tr("Open in a new zone"),
110 117 [ var = impl->m_Variable, tabWidget ]() { tabWidget->createZone(var); });
118
119 // 'Unplot' menu
120 impl->visitNodeLeaveUnplot();
111 121 }
112 122 else {
113 123 qCCritical(LOG_GenerateVariableMenuOperation(),
@@ -130,9 +140,13 void GenerateVariableMenuOperation::visitEnter(VisualizationZoneWidget *zoneWidg
130 140 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidget)
131 141 {
132 142 if (zoneWidget) {
133 impl->visitNodeLeave(
143 // 'Plot' menu
144 impl->visitNodeLeavePlot(
134 145 *zoneWidget, QObject::tr("Open in a new graph"),
135 146 [ var = impl->m_Variable, zoneWidget ]() { zoneWidget->createGraph(var); });
147
148 // 'Unplot' menu
149 impl->visitNodeLeaveUnplot();
136 150 }
137 151 else {
138 152 qCCritical(LOG_GenerateVariableMenuOperation(),
General Comments 0
You need to be logged in to leave comments. Login now