Add Cancel back to query menu

This commit is contained in:
eelke 2019-08-16 08:27:05 +02:00
parent 460d6f5809
commit 6d4df99100
2 changed files with 18 additions and 1 deletions

View file

@ -109,6 +109,12 @@ void DatabaseWindow::createActions()
auto action = actionAbout = new QAction(icon, tr("About"), this); auto action = actionAbout = new QAction(icon, tr("About"), this);
action->setObjectName("actionAbout"); action->setObjectName("actionAbout");
} }
{
QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/script_delete.png"), QSize(), QIcon::Normal, QIcon::On);
auto action = actionCancelQuery = new QAction(icon, tr("Cancel query"), this);
action->setObjectName("actionCancelQuery");
}
{ {
QIcon icon; QIcon icon;
icon.addFile(QString::fromUtf8(":/icons/page_white_delete.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/icons/page_white_delete.png"), QSize(), QIcon::Normal, QIcon::On);
@ -251,7 +257,8 @@ void DatabaseWindow::initMenus()
menuQuery->addActions({ menuQuery->addActions({
actionExecuteQuery, actionExecuteQuery,
actionExplain, actionExplain,
actionExplainAnalyze actionExplainAnalyze,
actionCancelQuery
}); });
menuWindow = mb->addMenu(tr("Window")); menuWindow = mb->addMenu(tr("Window"));
@ -318,6 +325,14 @@ void DatabaseWindow::on_actionAbout_triggered()
} }
void DatabaseWindow::on_actionCancelQuery_triggered()
{
auto query_tool = GetActiveQueryTool();
if (query_tool) {
query_tool->cancel();
}
}
void DatabaseWindow::on_actionCopy_triggered() void DatabaseWindow::on_actionCopy_triggered()
{ {
QWidget *w = QApplication::focusWidget(); QWidget *w = QApplication::focusWidget();

View file

@ -61,6 +61,7 @@ private:
// Standard actions // Standard actions
QAction *actionAbout = nullptr; QAction *actionAbout = nullptr;
QAction *actionCancelQuery = nullptr;
QAction *actionClose = nullptr; QAction *actionClose = nullptr;
QAction *actionCopy = nullptr; QAction *actionCopy = nullptr;
QAction *actionCopyAsCString = nullptr; QAction *actionCopyAsCString = nullptr;
@ -116,6 +117,7 @@ private slots:
// void tabWidget_currentChanged(int index); // void tabWidget_currentChanged(int index);
void on_actionAbout_triggered(); void on_actionAbout_triggered();
void on_actionCancelQuery_triggered();
void on_actionClose_triggered(); void on_actionClose_triggered();
void on_actionCopy_triggered(); void on_actionCopy_triggered();
void on_actionCopyAsCString_triggered(); void on_actionCopyAsCString_triggered();