Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25778

QTextDocument::toHtml output incorrect result when some block's font pixel size property is set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.8.x, 5.0.0
    • 4.8.1
    • GUI: Text handling
    • None
    • e640ebacb97f6eea9614925b1da3b97a0ff51409, 3a13f3f16e45288f7717dcfe3e968e5cccc05d90

    Description

      A simple TextDocument has a text block with text "Some Text", toHtml output:

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
      <html><head><meta name="qrichtext" content="1" /><style type="text/css">
      p, li { white-space: pre-wrap; }
      </style></head><body style=" font-family:'SimSun'; font-size:16px; font-weight:400; font-style:normal;">
      <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" foSome Text</p></body></html>
      

      I suppose someone forggotten add "attributesEmitted = true;" in block qtextdocument.cpp line 2186-2190. It should be:

          } else if (format.hasProperty(QTextFormat::FontPixelSize)) {
              html += QLatin1String(" font-size:");
              html += QString::number(format.intProperty(QTextFormat::FontPixelSize));
              html += QLatin1String("px;");
              attributesEmitted = true;
          }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            anly Shouwei Niu
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes