diff options
Diffstat (limited to 'src/gui/text/qtextdocument.cpp')
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 44d1b2f201..129a326ba2 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2908,7 +2908,11 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block) html += QLatin1Char('>'); html += QLatin1String("<pre"); } else if (!list) { - html += QLatin1String("<p"); + int headingLevel = blockFormat.headingLevel(); + if (headingLevel > 0 && headingLevel <= 6) + html += QLatin1String("<h") + QString::number(headingLevel); + else + html += QLatin1String("<p"); } emitBlockAttributes(block); @@ -2931,8 +2935,13 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block) html += QLatin1String("</pre>"); else if (list) html += QLatin1String("</li>"); - else - html += QLatin1String("</p>"); + else { + int headingLevel = blockFormat.headingLevel(); + if (headingLevel > 0 && headingLevel <= 6) + html += QLatin1String("</h") + QString::number(headingLevel) + QLatin1Char('>'); + else + html += QLatin1String("</p>"); + } if (list) { if (list->itemNumber(block) == list->count() - 1) { // last item? close list |