summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2016-09-21 18:02:51 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2016-11-25 11:44:07 +0000
commit41eddfaa4af8aba3820c8401993600e83633f9bc (patch)
tree3b437be48265f3f217352d2bf186fc1bff88687a /src/webengine/api/qquickwebengineview.cpp
parent5ca2d76b78df1839b92b04d7d6e7710f5d402c98 (diff)
Move the QPrinter and QtWidgets related code out of the PDFium wrapper
This moves the actual printing using QPrinter to the WebEngineWidgets part of the API. The printsupport module depends on the widgets module and therefore QtWebEngineCore also had a dependency to widgets. This is removed by this change. Change-Id: If6e5745709a59de18f2123b930cbe6e64390c867 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 6ca9954cf..3830a3ea2 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -1302,16 +1302,19 @@ bool QQuickWebEngineView::recentlyAudible() const
void QQuickWebEngineView::printToPdf(const QString& filePath, PrintedPageSizeId pageSizeId, PrintedPageOrientation orientation)
{
+#if defined(ENABLE_PDF)
Q_D(const QQuickWebEngineView);
QPageSize layoutSize(static_cast<QPageSize::PageSizeId>(pageSizeId));
QPageLayout::Orientation layoutOrientation = static_cast<QPageLayout::Orientation>(orientation);
QPageLayout pageLayout(layoutSize, layoutOrientation, QMarginsF(0.0, 0.0, 0.0, 0.0));
d->adapter->printToPDF(pageLayout, filePath);
+#endif
}
void QQuickWebEngineView::printToPdf(const QJSValue &callback, PrintedPageSizeId pageSizeId, PrintedPageOrientation orientation)
{
+#if defined (ENABLE_PDF)
Q_D(QQuickWebEngineView);
QPageSize layoutSize(static_cast<QPageSize::PageSizeId>(pageSizeId));
QPageLayout::Orientation layoutOrientation = static_cast<QPageLayout::Orientation>(orientation);
@@ -1322,6 +1325,13 @@ void QQuickWebEngineView::printToPdf(const QJSValue &callback, PrintedPageSizeId
quint64 requestId = d->adapter->printToPDFCallbackResult(pageLayout);
d->m_callbacks.insert(requestId, callback);
+#else
+ // Call back with null result.
+ QJSValueList args;
+ args.append(QJSValue(QByteArray().data()));
+ QJSValue callbackCopy = callback;
+ callbackCopy.call(args);
+#endif
}
void QQuickWebEngineView::replaceMisspelledWord(const QString &replacement)