Skip to content
Snippets Groups Projects
Commit 284fc632 authored by kh1's avatar kh1
Browse files

Backport some Qt Assistant print fixes.

Reviewed-by: ck
parent 0dfe7b9b
No related branches found
No related tags found
No related merge requests found
...@@ -234,16 +234,15 @@ void CentralWidget::print() ...@@ -234,16 +234,15 @@ void CentralWidget::print()
if (HelpViewer* viewer = currentHelpViewer()) { if (HelpViewer* viewer = currentHelpViewer()) {
initPrinter(); initPrinter();
QPrintDialog *dlg = new QPrintDialog(printer, this); QPrintDialog dlg(printer, this);
dlg->setWindowTitle(tr("Print Document")); dlg.setWindowTitle(tr("Print Document"));
if (!viewer->selectedText().isEmpty()) if (!viewer->selectedText().isEmpty())
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection); dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection);
dlg->addEnabledOption(QAbstractPrintDialog::PrintPageRange); dlg.addEnabledOption(QAbstractPrintDialog::PrintPageRange);
dlg->addEnabledOption(QAbstractPrintDialog::PrintCollateCopies); dlg.addEnabledOption(QAbstractPrintDialog::PrintCollateCopies);
if (dlg->exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted)
viewer->print(printer); viewer->print(printer);
delete dlg;
} }
#endif #endif
} }
...@@ -370,6 +369,7 @@ void CentralWidget::connectSignals(HelpViewer *page) ...@@ -370,6 +369,7 @@ void CentralWidget::connectSignals(HelpViewer *page)
connect(page, SIGNAL(sourceChanged(QUrl)), this, SLOT(handleSourceChanged(QUrl))); connect(page, SIGNAL(sourceChanged(QUrl)), this, SLOT(handleSourceChanged(QUrl)));
connect(page, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(page, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool)));
connect(page, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(page, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool)));
connect(page, SIGNAL(printRequested()), this, SLOT(print()));
} }
bool CentralWidget::eventFilter(QObject *object, QEvent *e) bool CentralWidget::eventFilter(QObject *object, QEvent *e)
......
...@@ -108,6 +108,7 @@ signals: ...@@ -108,6 +108,7 @@ signals:
void sourceChanged(const QUrl &); void sourceChanged(const QUrl &);
void forwardAvailable(bool enabled); void forwardAvailable(bool enabled);
void backwardAvailable(bool enabled); void backwardAvailable(bool enabled);
void printRequested();
#else #else
void loadFinished(bool finished); void loadFinished(bool finished);
#endif #endif
......
...@@ -251,6 +251,7 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent) ...@@ -251,6 +251,7 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent)
connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
connect(this, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged())); connect(this, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged()));
connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested()));
setFont(viewerFont()); setFont(viewerFont());
setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment