Proof of concept for binding signal to passed in slot name.

This commit is contained in:
eelke 2019-01-04 18:46:02 +01:00
parent a5f4e4c54f
commit 4a78330153
2 changed files with 6 additions and 2 deletions

View file

@ -650,7 +650,9 @@ std::vector<QAction*> QueryTab::getToolbarActions()
// Execute SQL
action = new QAction(QIcon(":/icons/script_go.png"), tr("Execute"), this);
action->setShortcut(QKeySequence(Qt::Key_F5));
connect(action, &QAction::triggered, this, &QueryTab::execute);
//connect(action, &QAction::triggered, this, &QueryTab::execute);
std::string slot_name = SLOT(execute());
connect(action, SIGNAL(triggered()), this, slot_name.c_str());
actions.push_back(action);
// Explain
action = new QAction(QIcon(":/icons/lightbulb_off.png"), tr("Explain"), this);
@ -678,6 +680,7 @@ void QueryToolModule::init()
{ menuAction_new(context); });
ma_new.setMenuLocation(MenuPath("File/New"));
ma_new.setIcon(QIcon(":/icons/new_query_tab.png"));
ma_new.setShortCut(QKeySequence(Qt::CTRL + Qt::Key_N));
registerMenuAction(ma_new);
}