Skip to content

Commit 087362d

Browse files
committed
GUI: MenuBuilder class for building menus in one central place (runtime variation of the menu structure is possible)
1 parent 58168e0 commit 087362d

File tree

5 files changed

+314
-240
lines changed

5 files changed

+314
-240
lines changed

src/gui/Src/BasicView/AbstractTableView.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <QMenu>
1111
#include "StringUtil.h"
1212
#include "Configuration.h"
13+
#include "MenuBuilder.h"
1314

1415
//Hacky class that fixes a really annoying cursor problem
1516
class AbstractTableScrollBar : public QScrollBar
@@ -240,6 +241,18 @@ public slots:
240241
}
241242

242243
protected:
244+
inline QMenu* makeMenu(const QString & title)
245+
{
246+
return new QMenu(title, this);
247+
}
248+
249+
inline QMenu* makeMenu(const QIcon & icon, const QString & title)
250+
{
251+
QMenu* menu = new QMenu(title, this);
252+
menu->setIcon(icon);
253+
return menu;
254+
}
255+
243256
inline QAction* makeAction(const QString & text, const char* slot)
244257
{
245258
return connectAction(new QAction(text, this), slot);

0 commit comments

Comments
 (0)