summaryrefslogtreecommitdiffstats
path: root/examples/webenginewidgets
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2021-06-03 01:37:37 +0200
committerSzabolcs David <davidsz@inf.u-szeged.hu>2021-06-03 14:05:22 +0200
commit4943d9801ccad59aef073374644fc991e49987e3 (patch)
tree4a4495c6a3391aa1bc4ad42d1548ff2f1bc9e46e /examples/webenginewidgets
parent57140466f277a074b288a515b2bdfd26c8a3cbe3 (diff)
Drop printsupport dependency from core
Prevent linkage of core to widgets by moving printing API from QWebEnginePage to View and using QPagedPaintDevice (the QtGui ancestor of QPrinter) where it's needed. Change-Id: I6ea96edb495b0dcaaa584bbe72632fda025c18d3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'examples/webenginewidgets')
-rw-r--r--examples/webenginewidgets/html2pdf/html2pdf.cpp14
-rw-r--r--examples/webenginewidgets/printme/printhandler.cpp4
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/webenginewidgets/html2pdf/html2pdf.cpp b/examples/webenginewidgets/html2pdf/html2pdf.cpp
index e9fc69534..1b52d69b1 100644
--- a/examples/webenginewidgets/html2pdf/html2pdf.cpp
+++ b/examples/webenginewidgets/html2pdf/html2pdf.cpp
@@ -52,7 +52,7 @@
#include <QCommandLineParser>
#include <QFile>
#include <QTextStream>
-#include <QWebEnginePage>
+#include <QWebEngineView>
#include <functional>
@@ -73,23 +73,23 @@ private slots:
private:
QString m_inputPath;
QString m_outputPath;
- QScopedPointer<QWebEnginePage> m_page;
+ QScopedPointer<QWebEngineView> m_view;
};
Html2PdfConverter::Html2PdfConverter(QString inputPath, QString outputPath)
: m_inputPath(move(inputPath))
, m_outputPath(move(outputPath))
- , m_page(new QWebEnginePage)
+ , m_view(new QWebEngineView)
{
- connect(m_page.data(), &QWebEnginePage::loadFinished,
+ connect(m_view.data(), &QWebEngineView::loadFinished,
this, &Html2PdfConverter::loadFinished);
- connect(m_page.data(), &QWebEnginePage::pdfPrintingFinished,
+ connect(m_view.data(), &QWebEngineView::pdfPrintingFinished,
this, &Html2PdfConverter::pdfPrintingFinished);
}
int Html2PdfConverter::run()
{
- m_page->load(QUrl::fromUserInput(m_inputPath));
+ m_view->load(QUrl::fromUserInput(m_inputPath));
return QApplication::exec();
}
@@ -102,7 +102,7 @@ void Html2PdfConverter::loadFinished(bool ok)
return;
}
- m_page->printToPdf(m_outputPath);
+ m_view->printToPdf(m_outputPath);
}
void Html2PdfConverter::pdfPrintingFinished(const QString &filePath, bool success)
diff --git a/examples/webenginewidgets/printme/printhandler.cpp b/examples/webenginewidgets/printme/printhandler.cpp
index 3534c155b..58114a610 100644
--- a/examples/webenginewidgets/printme/printhandler.cpp
+++ b/examples/webenginewidgets/printme/printhandler.cpp
@@ -66,7 +66,7 @@ void PrintHandler::setView(QWebEngineView *view)
{
Q_ASSERT(!m_view);
m_view = view;
- connect(view->page(), &QWebEnginePage::printRequested, this, &PrintHandler::printPreview);
+ connect(view, &QWebEngineView::printRequested, this, &PrintHandler::printPreview);
}
void PrintHandler::print()
@@ -83,7 +83,7 @@ void PrintHandler::printDocument(QPrinter *printer)
QEventLoop loop;
bool result;
auto printPreview = [&](bool success) { result = success; loop.quit(); };
- m_view->page()->print(printer, std::move(printPreview));
+ m_view->print(printer, std::move(printPreview));
loop.exec();
if (!result) {
QPainter painter;