From 0eb26c144346dcb12008e5b3e9441073f09668a8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Sun, 19 May 2019 13:06:05 +0200 Subject: QTextBrowser: detect and load markdown rather than assuming HTML So we add the QTextDocument::ResourceType::MarkdownResource enum value to indicate the type. QMimeDatabase is generally unable to detect markdown by "magic", so we need to use the common file extensions to detect it (the same extensions as declared in the mime database XML). Change-Id: Ib71f03abd535c17e5a8c99bd92d0a6062e972837 Reviewed-by: Simon Hausmann --- src/gui/text/qtextdocument.cpp | 1 + src/gui/text/qtextdocument.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/gui/text') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 3266819bf3..c800cea3f6 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2076,6 +2076,7 @@ void QTextDocument::print(QPagedPaintDevice *printer) const The icon needs to be converted to one of the supported types first, for example using QIcon::pixmap. \value StyleSheetResource The resource contains CSS. + \value MarkdownResource The resource contains Markdown. \value UserResource The first available value for user defined resource types. diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 31c06976a5..edb6bd9310 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -228,6 +228,7 @@ public: HtmlResource = 1, ImageResource = 2, StyleSheetResource = 3, + MarkdownResource = 4, UserResource = 100 }; -- cgit v1.2.3