summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextmarkdownimporter.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-01-04 18:24:39 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2022-01-12 20:51:26 +0100
commitf28570b2b788e6d392e3d2f437e341a5db27a1c4 (patch)
tree71beadf5bce7b2102b29ac1117049d918f7d8a53 /src/gui/text/qtextmarkdownimporter.cpp
parentbfbe4cab66958c7b96fb9033c13ae378cb450bec (diff)
QTextMarkdownImporter: don't apply text char format to list item block
We want an ordered list item's number to be rendered with default char format, like the others in the same list, even if the list item's text begins with a span that has a different char format. So insert the list item's block with a default char format first, then change the char format of the cursor to suit the text that's about to be inserted. In HTML interpretation, it means the <li> does not have a style, but contains a styled span. Fixes: QTBUG-92445 Task-number: QTBUG-3583 Task-number: QTBUG-99148 Change-Id: I7eb58a8d1171c16503cac01c8cce109d9f12e1af Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit f1e60de66540b198d696253ab5148de4fcbff319) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/text/qtextmarkdownimporter.cpp')
-rw-r--r--src/gui/text/qtextmarkdownimporter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp
index 2758d558a2..f94a6c5430 100644
--- a/src/gui/text/qtextmarkdownimporter.cpp
+++ b/src/gui/text/qtextmarkdownimporter.cpp
@@ -621,6 +621,9 @@ void QTextMarkdownImporter::insertBlock()
if (m_doc->isEmpty()) {
m_cursor->setBlockFormat(blockFormat);
m_cursor->setCharFormat(charFormat);
+ } else if (m_listItem) {
+ m_cursor->insertBlock(blockFormat, QTextCharFormat());
+ m_cursor->setCharFormat(charFormat);
} else {
m_cursor->insertBlock(blockFormat, charFormat);
}