From 2f9dcf231af1a836c19bffbea3f7f566b4a90083 Mon Sep 17 00:00:00 2001 From: Viktor Arvidsson Date: Sun, 14 Jan 2024 02:53:02 +0100 Subject: [PATCH] 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 --- src/gui/text/qtextdocument.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index ea0cc27f59..df00c809d1 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -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;