summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexthtmlparser.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-01-17 17:38:55 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-31 00:24:48 +0100
commitf26928cccf7e0fd9f06236476f2a6b52151e5dca (patch)
tree9464f786b5c27d1b5669e0c09eb87414f9529d64 /src/gui/text/qtexthtmlparser.cpp
parentf6723cf0d479823a34e874bc4cc9ff43e040793a (diff)
Allow QTextCharFormat::setFont() to skip unresolved font props
This makes the font merging possible and solves an issue with the default font properties inheritance when used in conjunction with QTextFormatCollection. Change-Id: If8b543c011122dde9f086f5d696df3b042f7b90c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r--src/gui/text/qtexthtmlparser.cpp28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 3cb61b9eae..e8a02c44b2 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1361,33 +1361,7 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
QFont f;
int adjustment = -255;
extractor.extractFont(&f, &adjustment);
- if (f.resolve() & QFont::SizeResolved) {
- if (f.pointSize() > 0) {
- charFormat.setFontPointSize(f.pointSize());
- } else if (f.pixelSize() > 0) {
- charFormat.setProperty(QTextFormat::FontPixelSize, f.pixelSize());
- }
- }
- if (f.resolve() & QFont::StyleResolved)
- charFormat.setFontItalic(f.style() != QFont::StyleNormal);
-
- if (f.resolve() & QFont::WeightResolved)
- charFormat.setFontWeight(f.weight());
-
- if (f.resolve() & QFont::FamilyResolved)
- charFormat.setFontFamily(f.family());
-
- if (f.resolve() & QFont::UnderlineResolved)
- charFormat.setUnderlineStyle(f.underline() ? QTextCharFormat::SingleUnderline : QTextCharFormat::NoUnderline);
-
- if (f.resolve() & QFont::OverlineResolved)
- charFormat.setFontOverline(f.overline());
-
- if (f.resolve() & QFont::StrikeOutResolved)
- charFormat.setFontStrikeOut(f.strikeOut());
-
- if (f.resolve() & QFont::CapitalizationResolved)
- charFormat.setFontCapitalization(f.capitalization());
+ charFormat.setFont(f, QTextCharFormat::FontPropertiesSpecifiedOnly);
if (adjustment >= -1)
charFormat.setProperty(QTextFormat::FontSizeAdjustment, adjustment);