diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2021-11-17 13:54:32 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-12-15 11:36:37 +0000 |
commit | 2e2f1e2af76d94a41f382e81ab8a6fdccf8ca579 (patch) | |
tree | ead0f36bf1d959a1cf71f7af538de513bad9f30e /src/gui/text/qtexthtmlparser.cpp | |
parent | ff97c8164253a882037836ae4381f6e669d3fce5 (diff) |
Add css media rule support for QTextDocument::setHtml()
CSS styles can contain '@media <rule> {...}' blocks, which were
previously ignored for all values except "screen".
To use a media rule other than the default "screen" rule,
specify it before calling setHtml() with setMetaInformation()
and the new info value 'CssMedia'.
[ChangeLog][Gui][QTextDocument] Add css media rule support
for QTextDocument::setHtml()
Pick-to: 6.3
Fixes: QTBUG-98408
Change-Id: Ie05f815a6dedbd970210f467e26b116f6ee3b9ca
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index ae2550b69e..85877bfe47 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -2165,7 +2165,7 @@ QList<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const for (int i = 0; i < inlineStyleSheets.count(); ++i, ++idx) selector.styleSheets[idx] = inlineStyleSheets.at(i); - selector.medium = QLatin1String("screen"); + selector.medium = resourceProvider ? resourceProvider->metaInformation(QTextDocument::CssMedia) : QLatin1String("screen"); QCss::StyleSelector::NodePtr n; n.id = node; |