QTextDocument: Add missing default pixel font size check for html export

If the size of the documents default font is specified in pixels all
text ranges would get wrapped in a span specifying the font size again.

Change-Id: Iae2ea34d79bb6253badd8a0575489d3fb6409eba
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Viktor Arvidsson 2024-01-14 02:53:02 +01:00
parent 06ea3e3994
commit 2f9dcf231a

View File

@ -2550,7 +2550,9 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format)
html += u';';
attributesEmitted = true;
}
} else if (format.hasProperty(QTextFormat::FontPixelSize)) {
} else if (format.hasProperty(QTextFormat::FontPixelSize)
&& format.property(QTextFormat::FontPixelSize)
!= defaultCharFormat.property(QTextFormat::FontPixelSize)) {
html += " font-size:"_L1;
html += QString::number(format.intProperty(QTextFormat::FontPixelSize));
html += "px;"_L1;