path: root/src/gui/text/qtextdocument.h
diff options
authorShawn Rutledge <>2017-12-19 15:25:55 +0100
committerShawn Rutledge <>2019-05-01 14:31:27 +0000
commit23c2da3cc23a2e04a0b3b3c8ad7fa9cc6126ff23 (patch)
tree849770044988425cf290b8599b44440653bcddd0 /src/gui/text/qtextdocument.h
parent9ec564b0bfc94c2d33f02b24ca081b64ff9ebb9b (diff)
Add QTextMarkdownWriter, QTextEdit::markdown property etc.
A QTextDocument can now be written out in Markdown format. - Add the QTextMarkdownWriter as a private class for now - Add QTextDocument::toMarkdown() - QTextDocumentWriter uses QTextMarkdownWriter if setFormat("markdown") is called or if the file suffix is .md or .mkd - Add QTextEdit::toMarkdown() and the markdown property [ChangeLog][QtGui][Text] Markdown (CommonMark or GitHub dialect) is now a supported format for reading into and writing from QTextDocument. Change-Id: I663a77017fac7ae1b3f9a400f5cd357bb40750af Reviewed-by: Gatis Paeglis <>
Diffstat (limited to 'src/gui/text/qtextdocument.h')
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index ade67999ad..31c06976a5 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -151,7 +151,7 @@ public:
void setHtml(const QString &html);
-#if QT_CONFIG(textmarkdownreader)
+#if QT_CONFIG(textmarkdownwriter) || QT_CONFIG(textmarkdownreader)
// Must be in sync with QTextMarkdownImporter::Features, should be in sync with #define MD_FLAG_* in md4c
enum MarkdownFeature {
MarkdownNoHTML = 0x0020 | 0x0040,
@@ -160,7 +160,13 @@ public:
Q_DECLARE_FLAGS(MarkdownFeatures, MarkdownFeature)
+#if QT_CONFIG(textmarkdownwriter)
+ QString toMarkdown(MarkdownFeatures features = MarkdownDialectGitHub) const;
+#if QT_CONFIG(textmarkdownreader)
void setMarkdown(const QString &markdown, MarkdownFeatures features = MarkdownDialectGitHub);