Printing support: print dialog from QScintilla widgets

Add printing support for QScintilla widgets (SQL, JSON and XML). It can be
access through the contextual menu, shortcut (Ctrl+P) or (in the case of
the "Execute SQL" tab) from a button in the toolbar.

Ctrl+P was previously assigned to Plot Dock since
63c338c359 but, as it was foreseen in that
commit, it should be assign to print is ever supported. This change must
be mentioned in release notes.

First part of printing support. See issue #1525.
This commit is contained in:
mgr
2018-09-16 16:06:27 +02:00
parent 9daf2657fc
commit 60c229c1c4
7 changed files with 71 additions and 7 deletions

View File

@@ -253,9 +253,7 @@ void MainWindow::init()
// Add menu item for plot dock
ui->viewMenu->insertAction(ui->viewDBToolbarAction, ui->dockPlot->toggleViewAction());
QList<QKeySequence> plotkeyseqlist;
plotkeyseqlist << QKeySequence(tr("Ctrl+P")) << QKeySequence(tr("Ctrl+D"));
ui->viewMenu->actions().at(1)->setShortcuts(plotkeyseqlist);
ui->viewMenu->actions().at(1)->setShortcut(QKeySequence(tr("Ctrl+D")));
ui->viewMenu->actions().at(1)->setIcon(QIcon(":/icons/log_dock"));
// Add menu item for schema dock
@@ -3276,6 +3274,15 @@ void MainWindow::openFindReplaceDialog()
sqlWidget->getEditor()->openFindReplaceDialog();
}
void MainWindow::openSqlPrintDialog()
{
// The slot for the shortcut must discover which sqltexedit widget has the focus and then open its dialog.
SqlExecutionArea* sqlWidget = qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget());
if (sqlWidget)
sqlWidget->getEditor()->openPrintDialog();
}
void MainWindow::saveAsView(QString query)
{
// Let the user select a name for the new view and make sure it doesn't already exist