diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-06-09 08:06:00 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-06-10 08:09:33 (GMT) |
commit | f541c78e1bc5b293466b40e6f10496199a4a5d73 (patch) | |
tree | 2c7deec117f43d26d7ffe8c7b14cae68e8fb431b /src/gui/text/qtextdocument.cpp | |
parent | 161fd33b199c96a92fbda4b009e85f910f73acc0 (diff) | |
download | Qt-f541c78e1bc5b293466b40e6f10496199a4a5d73.zip Qt-f541c78e1bc5b293466b40e6f10496199a4a5d73.tar.gz Qt-f541c78e1bc5b293466b40e6f10496199a4a5d73.tar.bz2 |
Fix missing empty lines in Qt HTML when displayed in compliant browsers
When QTextDocument exports HTML, it makes an effort to be compatible
with its own importer, hence it has to be compatible with the dialect
of HTML which Qt has developed over the years. One incorrect
interpretation in Qt is that an empty paragraph is interpreted as an
empty line. So if you use a QTextDocument to produce HTML for text where
an empty line has been added, this empty line will not be visible when
the document is viewed in a compliant browser. The fix is to set the
height of the empty paragraph to 1em, so that it will match the current
pixel size of the font, thus look the same as a <p><br /></p> but
without altering the structure of the document.
Reviewed-by: Gunnar
Diffstat (limited to 'src/gui/text/qtextdocument.cpp')
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index fe3c993..74b1c69 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2553,7 +2553,7 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block) const bool emptyBlock = block.begin().atEnd(); if (emptyBlock) { - html += QLatin1String("-qt-paragraph-type:empty;"); + html += QLatin1String("-qt-paragraph-type:empty; height:1em;"); } emitMargins(QString::number(format.topMargin()), |