forked from qt-creator/qt-creator
Backport some Qt Assistant print fixes.
Reviewed-by: ck
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user