summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocument.cpp16
-rw-r--r--src/gui/text/qtexthtmlparser.cpp8
2 files changed, 23 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 71511257f51..463026ed238 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2372,6 +2372,8 @@ QString QTextHtmlExporter::toHtml(ExportMode mode)
html += "<style type=\"text/css\">\n"_L1;
html += "p, li { white-space: pre-wrap; }\n"_L1;
html += "hr { height: 1px; border-width: 0; }\n"_L1;
+ html += "li.unchecked::marker { content: \"\\2610\"; }\n"_L1;
+ html += "li.checked::marker { content: \"\\2612\"; }\n"_L1;
html += "</style>"_L1;
html += "</head><body"_L1;
@@ -3038,7 +3040,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
html += " style=\""_L1;
html += styleString;
- html += "\">"_L1;
+ html += "\">\n"_L1;
}
html += "<li"_L1;
@@ -3051,6 +3053,18 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
defaultCharFormat.merge(block.charFormat());
}
+ if (block.blockFormat().hasProperty(QTextFormat::BlockMarker)) {
+ switch (block.blockFormat().marker()) {
+ case QTextBlockFormat::MarkerType::Checked:
+ html += " class=\"checked\""_L1;
+ break;
+ case QTextBlockFormat::MarkerType::Unchecked:
+ html += " class=\"unchecked\""_L1;
+ break;
+ case QTextBlockFormat::MarkerType::NoMarker:
+ break;
+ }
+ }
}
const QTextBlockFormat blockFormat = block.blockFormat();
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index a10b8808862..ded2dd185a5 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1636,6 +1636,14 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
}
}
break;
+ case Html_li:
+ if (key == "class"_L1) {
+ if (value == "unchecked"_L1)
+ node->blockFormat.setMarker(QTextBlockFormat::MarkerType::Unchecked);
+ else if (value == "checked"_L1)
+ node->blockFormat.setMarker(QTextBlockFormat::MarkerType::Checked);
+ }
+ break;
case Html_a:
if (key == "href"_L1)
node->charFormat.setAnchorHref(value);