diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index d1f77bb55711daeac79aad6af50cff58bd32dede..22215f3100fa291d4baa341b15fa8a88a8491f4c 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -234,16 +234,15 @@ void CentralWidget::print() if (HelpViewer* viewer = currentHelpViewer()) { initPrinter(); - QPrintDialog *dlg = new QPrintDialog(printer, this); - dlg->setWindowTitle(tr("Print Document")); + QPrintDialog dlg(printer, this); + dlg.setWindowTitle(tr("Print Document")); if (!viewer->selectedText().isEmpty()) - dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection); - dlg->addEnabledOption(QAbstractPrintDialog::PrintPageRange); - dlg->addEnabledOption(QAbstractPrintDialog::PrintCollateCopies); - - if (dlg->exec() == QDialog::Accepted) + dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection); + dlg.addEnabledOption(QAbstractPrintDialog::PrintPageRange); + dlg.addEnabledOption(QAbstractPrintDialog::PrintCollateCopies); + + if (dlg.exec() == QDialog::Accepted) viewer->print(printer); - delete dlg; } #endif } @@ -370,6 +369,7 @@ void CentralWidget::connectSignals(HelpViewer *page) connect(page, SIGNAL(sourceChanged(QUrl)), this, SLOT(handleSourceChanged(QUrl))); connect(page, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(page, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); + connect(page, SIGNAL(printRequested()), this, SLOT(print())); } bool CentralWidget::eventFilter(QObject *object, QEvent *e) diff --git a/src/plugins/help/helpviewer.h b/src/plugins/help/helpviewer.h index 75e55fe6f2ad411abffcea58054fb770b4f159aa..de67233c63983851e93a462529622369a55546ac 100644 --- a/src/plugins/help/helpviewer.h +++ b/src/plugins/help/helpviewer.h @@ -108,6 +108,7 @@ signals: void sourceChanged(const QUrl &); void forwardAvailable(bool enabled); void backwardAvailable(bool enabled); + void printRequested(); #else void loadFinished(bool finished); #endif diff --git a/src/plugins/help/helpviewer_qwv.cpp b/src/plugins/help/helpviewer_qwv.cpp index abf812797e7168485f99655c57233fdf81b6c12e..499a527774612f3fc3ac98ee95cb24cc1f8e6ba1 100644 --- a/src/plugins/help/helpviewer_qwv.cpp +++ b/src/plugins/help/helpviewer_qwv.cpp @@ -251,6 +251,7 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent) connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); connect(this, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged())); + connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested())); setFont(viewerFont()); setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);