summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-01-13 22:45:01 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-05-27 11:55:02 +0200
commit3373aa8b351691d395cd15c634ca1b60fd688c6a (patch)
treeed7f963f5ea74d41c9cbb8c3204b6a5ffc2a3491 /src/gui
parent2503a59e353e5714b184b499e10969aed9f80465 (diff)
QTextMarkdownImporter: allow nesting text span formatting
The bold+italic combination indicated by ***triple stars*** requires this; but it enables combinations of italics, bold, strikeout, anchor text (and associated link formatting), image alternate text, and inline code formatting (monospace). A code span overrides the formatting from surrounding spans (which might be a bug to fix in another patch, if we compare to how md2html formats code nested in bold-italics for example), but the format stack restores state when any char format span ends. Task-number: QTBUG-81306 Pick-to: 5.15 Change-Id: I289556fa53de400eb50a4d159b9b344eafc517da Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextmarkdownimporter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp
index a5c5fb3678..b5532696f4 100644
--- a/src/gui/text/qtextmarkdownimporter.cpp
+++ b/src/gui/text/qtextmarkdownimporter.cpp
@@ -388,6 +388,8 @@ int QTextMarkdownImporter::cbLeaveBlock(int blockType, void *detail)
int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det)
{
QTextCharFormat charFmt;
+ if (!m_spanFormatStack.isEmpty())
+ charFmt = m_spanFormatStack.top();
switch (spanType) {
case MD_SPAN_EM:
charFmt.setFontItalic(true);