summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebenginesettings.cpp
diff options
context:
space:
mode:
authorMichael Bruning <michael.bruning@qt.io>2016-08-09 16:28:44 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2016-08-28 06:50:44 +0000
commit54b7425c356378018c511bd9087f06767d0bc708 (patch)
tree5c95c24e5c70d1a7ae9bf4d9cc6d55ae5788e5e9 /src/webengine/api/qquickwebenginesettings.cpp
parent2609e257926c36e211a5aec9d6675e27dd447aad (diff)
Add setting to enable printing of CSS backgrounds
[ChangeLog][Printing] Printing will now include the CSS background of the printed elements by default. This restores the default behavior from Qt WebKit. It can be controlled via the PrintElementBackgrounds web setting. Task-number: QTBUG-54918 Change-Id: I37c37456dfec6368f22c36c515ac3cad1bbf8006 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webengine/api/qquickwebenginesettings.cpp')
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index a69db0554..2393f877a 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -318,6 +318,19 @@ bool QQuickWebEngineSettings::focusOnNavigationEnabled() const
}
/*!
+ \qmlproperty bool WebEngineSettings::printElementBackgrounds
+ \since QtWebEngine 1.4
+
+ Turns on printing of CSS backgrounds when printing to PDF.
+
+ Enabled by default.
+*/
+bool QQuickWebEngineSettings::printElementBackgrounds() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::PrintElementBackgrounds);
+}
+
+/*!
\qmlproperty QString WebEngineSettings::defaultTextEncoding
\since QtWebEngine 1.2
@@ -478,6 +491,14 @@ void QQuickWebEngineSettings::setTouchIconsEnabled(bool on)
Q_EMIT touchIconsEnabledChanged();
}
+void QQuickWebEngineSettings::setPrintElementBackgrounds(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::PrintElementBackgrounds);
+ d_ptr->setAttribute(WebEngineSettings::PrintElementBackgrounds, on);
+ if (wasOn != on)
+ Q_EMIT printElementBackgroundsChanged();
+}
+
void QQuickWebEngineSettings::setDefaultTextEncoding(QString encoding)
{
const QString oldDefaultTextEncoding = d_ptr->defaultTextEncoding();