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()) {
|
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)
|
|||||||
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:
|
|||||||
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)
|
|||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user