##// END OF EJS Templates
Unplot menu (1)...
Alexandre Leroux -
r323:55e8cf41b3b4
parent child
Show More
@@ -14,26 +14,26 Q_LOGGING_CATEGORY(LOG_GenerateVariableMenuOperation, "GenerateVariableMenuOpera
14
14
15 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
15 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
16 explicit GenerateVariableMenuOperationPrivate(QMenu *menu, std::shared_ptr<Variable> variable)
16 explicit GenerateVariableMenuOperationPrivate(QMenu *menu, std::shared_ptr<Variable> variable)
17 : m_Variable{variable}, m_MenuBuilder{menu}
17 : m_Variable{variable}, m_PlotMenuBuilder{menu}
18 {
18 {
19 }
19 }
20
20
21 void visitRootEnter()
21 void visitRootEnter()
22 {
22 {
23 // Creates the root menu
23 // Creates the root menu
24 m_MenuBuilder.addMenu(QObject::tr("Plot"), QIcon{":/icones/plot.png"});
24 m_PlotMenuBuilder.addMenu(QObject::tr("Plot"), QIcon{":/icones/plot.png"});
25 }
25 }
26
26
27 void visitRootLeave()
27 void visitRootLeave()
28 {
28 {
29 // Closes the root menu
29 // Closes the root menu
30 m_MenuBuilder.closeMenu();
30 m_PlotMenuBuilder.closeMenu();
31 }
31 }
32
32
33 void visitNodeEnter(const IVisualizationWidget &container)
33 void visitNodeEnter(const IVisualizationWidget &container)
34 {
34 {
35 // Opens a new menu associated to the node
35 // Opens a new menu associated to the node
36 m_MenuBuilder.addMenu(container.name());
36 m_PlotMenuBuilder.addMenu(container.name());
37 }
37 }
38
38
39 template <typename ActionFun>
39 template <typename ActionFun>
@@ -41,12 +41,12 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
41 ActionFun actionFunction)
41 ActionFun actionFunction)
42 {
42 {
43 if (m_Variable && container.canDrop(*m_Variable)) {
43 if (m_Variable && container.canDrop(*m_Variable)) {
44 m_MenuBuilder.addSeparator();
44 m_PlotMenuBuilder.addSeparator();
45 m_MenuBuilder.addAction(actionName, actionFunction);
45 m_PlotMenuBuilder.addAction(actionName, actionFunction);
46 }
46 }
47
47
48 // Closes the menu associated to the node
48 // Closes the menu associated to the node
49 m_MenuBuilder.closeMenu();
49 m_PlotMenuBuilder.closeMenu();
50 }
50 }
51
51
52 template <typename ActionFun>
52 template <typename ActionFun>
@@ -54,12 +54,12 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
54 ActionFun actionFunction)
54 ActionFun actionFunction)
55 {
55 {
56 if (m_Variable && container.canDrop(*m_Variable)) {
56 if (m_Variable && container.canDrop(*m_Variable)) {
57 m_MenuBuilder.addAction(actionName, actionFunction);
57 m_PlotMenuBuilder.addAction(actionName, actionFunction);
58 }
58 }
59 }
59 }
60
60
61 std::shared_ptr<Variable> m_Variable;
61 std::shared_ptr<Variable> m_Variable;
62 MenuBuilder m_MenuBuilder;
62 MenuBuilder m_PlotMenuBuilder; ///< Builder for the 'Plot' menu
63 };
63 };
64
64
65 GenerateVariableMenuOperation::GenerateVariableMenuOperation(QMenu *menu,
65 GenerateVariableMenuOperation::GenerateVariableMenuOperation(QMenu *menu,
General Comments 0
You need to be logged in to leave comments. Login now