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 += ""_L1;
html += "
"_L1;
+ html += "\">\n"_L1;
}
html += "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);
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index ad9e1965b6c..d10027b7a01 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -274,6 +274,8 @@ void tst_QTextDocument::init()
""
"\n");
htmlHead = htmlHead.arg(defaultFont.family())
@@ -1371,7 +1373,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("lists") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("");
+ QString("");
}
{
@@ -1394,7 +1396,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("charfmt-for-list-item") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("");
+ QString("");
}
{
@@ -1424,7 +1426,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("list-indent") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("");
+ QString("");
}
{
@@ -1712,7 +1714,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("list-ul-margin") << QTextDocumentFragment(&doc)
<< QString("EMPTYBLOCK") +
- QString("");
+ QString("");
}
{
CREATE_DOC_AND_CURSOR();
@@ -1722,12 +1724,12 @@ void tst_QTextDocument::toHtml_data()
cursor.insertHtml(listHtml);
QTest::newRow("nested-lists-one") << QTextDocumentFragment(&doc)
- << QString("- \n
- "
- "item-1
\n- item-2\n
- \n
- item-2\n
\n- item-2.1
\n- item-2.2\n
\n"
- "- item-2.3\n
- "
+ "DEFAULTULSTYLE 3;\">\n
- item-2.2.1
\n"
+ "- item-2.3\n
\n- item-3
");
}
{
@@ -1736,9 +1738,9 @@ void tst_QTextDocument::toHtml_data()
cursor.insertHtml(listHtml);
QTest::newRow("nested-lists-two") << QTextDocumentFragment(&doc)
- << QString("- \n
- "
- "item-1
\n- item-2\n");
}
{
@@ -1748,9 +1750,9 @@ void tst_QTextDocument::toHtml_data()
cursor.insertHtml(listHtml);
QTest::newRow("nested-lists-three") << QTextDocumentFragment(&doc)
- << QString("
- \n
- "
- "item-1
\n- item-2\n");
}
@@ -1761,12 +1763,23 @@ void tst_QTextDocument::toHtml_data()
cursor.insertHtml(listHtml);
QTest::newRow("not-nested-list") << QTextDocumentFragment(&doc)
- << QString("
- \n
- "
- "item-1.1
\n- item-1.2
\n \n- item-1.2
\n");
}
+ {
+ CREATE_DOC_AND_CURSOR();
+ const QString listHtml = "- bullet
- unchecked item
- checked item
";
+ cursor.insertHtml(listHtml);
+
+ QTest::newRow("list with and without checkboxes") << QTextDocumentFragment(&doc)
+ << QString("\n"
+ "- bullet
\n"
+ "- unchecked item
\n"
+ "- checked item
");
+ }
}
void tst_QTextDocument::toHtml()
diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
index b258869dfd5..2b6b1ecca50 100644
--- a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
+++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
@@ -502,6 +502,9 @@ void tst_QTextMarkdownWriter::fromHtml_data()
QTest::newRow("preformats with embedded backticks") <<
"none `one` ``two``
plain```three``` ````four````
plain" <<
"```\nnone `one` ``two``\n\n```\nplain\n\n```\n```three``` ````four````\n\n```\nplain\n\n";
+ QTest::newRow("list items with and without checkboxes") <<
+ "- bullet
- unchecked item
- checked item
" <<
+ "- bullet\n- [ ] unchecked item\n- [x] checked item\n";
}
void tst_QTextMarkdownWriter::fromHtml()