Proof of concept for binding signal to passed in slot name.
This commit is contained in:
parent
a5f4e4c54f
commit
4a78330153
2 changed files with 6 additions and 2 deletions
|
|
@ -650,7 +650,9 @@ std::vector<QAction*> QueryTab::getToolbarActions()
|
||||||
// Execute SQL
|
// Execute SQL
|
||||||
action = new QAction(QIcon(":/icons/script_go.png"), tr("Execute"), this);
|
action = new QAction(QIcon(":/icons/script_go.png"), tr("Execute"), this);
|
||||||
action->setShortcut(QKeySequence(Qt::Key_F5));
|
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);
|
actions.push_back(action);
|
||||||
// Explain
|
// Explain
|
||||||
action = new QAction(QIcon(":/icons/lightbulb_off.png"), tr("Explain"), this);
|
action = new QAction(QIcon(":/icons/lightbulb_off.png"), tr("Explain"), this);
|
||||||
|
|
@ -678,6 +680,7 @@ void QueryToolModule::init()
|
||||||
{ menuAction_new(context); });
|
{ menuAction_new(context); });
|
||||||
ma_new.setMenuLocation(MenuPath("File/New"));
|
ma_new.setMenuLocation(MenuPath("File/New"));
|
||||||
ma_new.setIcon(QIcon(":/icons/new_query_tab.png"));
|
ma_new.setIcon(QIcon(":/icons/new_query_tab.png"));
|
||||||
|
ma_new.setShortCut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||||
registerMenuAction(ma_new);
|
registerMenuAction(ma_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ public:
|
||||||
bool saveAs();
|
bool saveAs();
|
||||||
void saveCopyAs();
|
void saveCopyAs();
|
||||||
|
|
||||||
void execute();
|
|
||||||
void explain(bool analyze);
|
void explain(bool analyze);
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|
||||||
|
|
@ -61,6 +60,8 @@ public:
|
||||||
void focusEditor();
|
void focusEditor();
|
||||||
|
|
||||||
virtual std::vector<QAction*> getToolbarActions() override;
|
virtual std::vector<QAction*> getToolbarActions() override;
|
||||||
|
public slots:
|
||||||
|
void execute();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
using ResultTabContainer = std::vector<TuplesResultWidget*>;
|
using ResultTabContainer = std::vector<TuplesResultWidget*>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue