diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 0e6543a9..af607264 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -3514,6 +3514,15 @@ void MainWindow::openFindReplaceDialog() sqlWidget->getEditor()->openFindReplaceDialog(); } +void MainWindow::toggleSqlBlockComment() +{ + // The slot for the shortcut must discover which sqltexedit widget has the focus + SqlExecutionArea* sqlWidget = qobject_cast(ui->tabSqlAreas->currentWidget()); + + if (sqlWidget) + sqlWidget->getEditor()->toggleBlockComment(); +} + void MainWindow::openSqlPrintDialog() { // The slot for the shortcut must discover which sqltexedit widget has the focus and then open its dialog. diff --git a/src/MainWindow.h b/src/MainWindow.h index eb6aae18..7d5d82e9 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -304,6 +304,7 @@ private slots: void renameSqlTab(int index); void setFindFrameVisibility(bool show); void openFindReplaceDialog(); + void toggleSqlBlockComment(); void openSqlPrintDialog(); void saveFilterAsView(); void exportFilteredTable(); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index db61474a..c2c0e1f1 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -946,6 +946,8 @@ You can drag SQL statements from an object row and drop them into other applicat + + @@ -2364,6 +2366,24 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Qt::WidgetShortcut + + + + :/icons/comment_block:/icons/comment_block + + + Un/comment block of SQL code + + + Comment or uncomment current line or selected block of code + + + Comment or uncomment the selected lines or the current line, when there is no selection. All the block is toggled according to the first line. + + + Ctrl+Shift+/ + + @@ -3777,6 +3797,22 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed + + actionSqlToggleComment + triggered() + MainWindow + toggleSqlBlockComment() + + + -1 + -1 + + + 518 + 314 + + + fileOpen() diff --git a/src/icons/comment_block.png b/src/icons/comment_block.png new file mode 100644 index 00000000..3b3ee4c4 Binary files /dev/null and b/src/icons/comment_block.png differ diff --git a/src/icons/icons.qrc b/src/icons/icons.qrc index a253a6ac..82f1b145 100644 --- a/src/icons/icons.qrc +++ b/src/icons/icons.qrc @@ -69,5 +69,6 @@ printer.png package_save.png cancel.png + comment_block.png diff --git a/src/sqltextedit.h b/src/sqltextedit.h index afba695f..796fd58c 100644 --- a/src/sqltextedit.h +++ b/src/sqltextedit.h @@ -22,8 +22,6 @@ public: public slots: void reloadSettings(); - -private slots: void toggleBlockComment(); };