Basic concept of MenuAction is working

Module can register action
Window adds this action to its menu
Clicking the menu item for the action has the expected result
But menu structure still needs work (everything is now put into one dropdown menu)
This commit is contained in:
eelke 2019-01-01 11:15:16 +01:00
parent f130c426a1
commit dc8a052544
12 changed files with 220 additions and 28 deletions

View file

@ -674,14 +674,18 @@ std::vector<QAction*> QueryTab::getToolbarActions()
void QueryToolModule::init()
{
auto action_new = new QAction(QIcon(":/icons/new_query_tab.png"), tr("New"), this);
connect(action_new, &QAction::triggered, this, &QueryToolModule::new_triggered);
registerAction(action_new, MenuLocation({"File/New"}), ToolbarLocation("File", ""));
MenuAction ma_new("New", [this] (IPluginContentWidgetContext* context)
{ menuAction_new(context); });
ma_new.setMenuLocation(MenuPath("File/New"));
ma_new.setIcon(QIcon(":/icons/new_query_tab.png"));
registerMenuAction(ma_new);
}
void QueryToolModule::new_triggered()
void QueryToolModule::menuAction_new(IPluginContentWidgetContext* context)
{
auto *ct = new QueryTab(context, nullptr);
context->addContentWidget(ct);
ct->newdoc();
}
REGISTER_PLUGIN_MODULE(QueryToolModule, "Query tool", "pglab.querytool")