##// END OF EJS Templates
Adds icon for 'Plot' menu
Alexandre Leroux -
r322:e195db267c87
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -27,8 +27,9 public:
27 /**
27 /**
28 * Adds a new menu to the current menu
28 * Adds a new menu to the current menu
29 * @param name the name of the menu
29 * @param name the name of the menu
30 * @param icon the icon of the menu (can be null)
30 */
31 */
31 void addMenu(const QString &name);
32 void addMenu(const QString &name, const QIcon &icon = {});
32
33
33 /// Adds a separator to the current menu. The separator is added only if the menu already
34 /// Adds a separator to the current menu. The separator is added only if the menu already
34 /// contains entries
35 /// contains entries
@@ -3,6 +3,7
3 <file>icones/delete.png</file>
3 <file>icones/delete.png</file>
4 <file>icones/openInspector.png</file>
4 <file>icones/openInspector.png</file>
5 <file>icones/next.png</file>
5 <file>icones/next.png</file>
6 <file>icones/plot.png</file>
6 <file>icones/previous.png</file>
7 <file>icones/previous.png</file>
7 </qresource>
8 </qresource>
8 </RCC>
9 </RCC>
@@ -21,7 +21,7 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
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"));
24 m_MenuBuilder.addMenu(QObject::tr("Plot"), QIcon{":/icones/plot.png"});
25 }
25 }
26
26
27 void visitRootLeave()
27 void visitRootLeave()
@@ -12,10 +12,10 MenuBuilder::MenuBuilder(QMenu *menu)
12 }
12 }
13 }
13 }
14
14
15 void MenuBuilder::addMenu(const QString &name)
15 void MenuBuilder::addMenu(const QString &name, const QIcon &icon)
16 {
16 {
17 if (auto currMenu = currentMenu()) {
17 if (auto currMenu = currentMenu()) {
18 m_Menus.push(currMenu->addMenu(name));
18 m_Menus.push(currMenu->addMenu(icon, name));
19 }
19 }
20 else {
20 else {
21 qCCritical(LOG_MenuBuilder()) << QObject::tr("No current menu to attach the new menu");
21 qCCritical(LOG_MenuBuilder()) << QObject::tr("No current menu to attach the new menu");
General Comments 0
You need to be logged in to leave comments. Login now