Moved definition of widget instance actions to the module so other parts of the system can no about them.
The plugin system will create the Action objects and bind them to the specified slots of the specific widget instances.
This commit is contained in:
parent
d0c4dabe8b
commit
f4f2474a81
21 changed files with 418 additions and 204 deletions
|
|
@ -93,19 +93,6 @@ void CrudTab::on_actionRemove_rows_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<QAction*> CrudTab::getToolbarActions()
|
||||
{
|
||||
if (actions.empty()) {
|
||||
QAction *action = new QAction(QIcon(":/icons/script_go.png"), tr("Refresh"), this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_F5));
|
||||
connect(action, &QAction::triggered, this, &CrudTab::refresh);
|
||||
actions.push_back(action);
|
||||
|
||||
actions.push_back(ui->actionRemove_rows);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
void CrudTab::headerCustomContextMenu(const QPoint &pos)
|
||||
{
|
||||
auto menu = new QMenu(this);
|
||||
|
|
@ -128,6 +115,14 @@ void CrudPageModule::init()
|
|||
{
|
||||
moduleAction_open(context, params);
|
||||
});
|
||||
|
||||
{
|
||||
LWidgetAction wa("Refresh", SLOT(refresh()));
|
||||
wa.setMenuLocation(MenuPath("Window/1"));
|
||||
wa.setIcon(QIcon(":/icons/script_go.png"));
|
||||
wa.setShortcut(QKeySequence(Qt::Key_F5));
|
||||
registerWidgetAction(wa);
|
||||
}
|
||||
}
|
||||
|
||||
void CrudPageModule::moduleAction_open(
|
||||
|
|
@ -138,7 +133,7 @@ void CrudPageModule::moduleAction_open(
|
|||
// create new widget for specified table
|
||||
// hand widget to context for display
|
||||
CrudTab *ct = new CrudTab(context, nullptr);
|
||||
context->addContentWidget(ct); // maybe CrudTab should do this
|
||||
context->addContentWidget(this, ct); // maybe CrudTab should do this
|
||||
ct->setConfig(params.at("oid").toUInt());
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue