refs #648, added a sortable menu action with metadata and changed IMenuDelegate

Idea: the menu will be generated as list of menu actions, then finalized before displayed
This commit is contained in:
Klaus Basan
2016-04-26 22:27:50 +02:00
parent 044af1a970
commit 930ebeee30
3 changed files with 725 additions and 11 deletions

View File

@@ -11,7 +11,7 @@
#define BLACKGUI_MENUS_MENUDELEGATE_H
#include "blackmisc/logcategorylist.h"
#include <QMenu>
#include "blackgui/menus/menuaction.h"
#include <QObject>
using namespace BlackMisc;
@@ -29,7 +29,7 @@ namespace BlackGui
public:
//! Display custom menu
virtual void customMenu(QMenu &menu) const = 0;
virtual void customMenu(CMenuActions &menuActions) = 0;
//! Set nested delegate
void setNestedDelegate(IMenuDelegate *nestedDelegate) { m_nestedDelegate = nestedDelegate; }
@@ -53,17 +53,10 @@ namespace BlackGui
QObject(parent), m_separator(separator) {}
//! Delegate down one level
void nestedCustomMenu(QMenu &menu) const
void nestedCustomMenu(CMenuActions &menuActions) const
{
if (!m_nestedDelegate) { return; }
m_nestedDelegate->customMenu(menu);
}
//! Add separator
virtual void addSeparator(QMenu &menu) const
{
if (!m_separator || menu.isEmpty()) { return; }
menu.addSeparator();
m_nestedDelegate->customMenu(menuActions);
}
//! Does the previous (menu) item contain string?