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

QTextDocument produces two styles attributes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.6, 5.15.2, 6.1.3
    • GUI: Text handling
    • None
    • MacOS / Windows
    • All

    Description

      QString html="<?xml version=\"1.0\"?>\n" QString html="<?xml version=\"1.0\"?>\n"
                             "<html>\n"             <body>\n"
                             "    <ol>\n"
                             "      <li style=\"text-decoration:underline\">\n"
                             "         content\n"
                             "      </li>\n"
                             "    </ol>\n"
                             </body>\n"
                             "</html>";
      QTextDocument doc;
      doc.setHtml(html);
      QXmlStreamReader xmlReader(doc.toHtml());
      while (!xmlReader.atEnd()) {
        xmlReader.readNext();
      }
      qDebug() << xmlReader.errorString(); // => Attribute 'style' redefined.
      

       
      Here is the content of the doc.toHtml() :

      <!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:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;">
          <ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;">
            <li style=" text-decoration: underline;" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">content </li>
          </ol>
        </body>
      </html>
      

       You can notice that the HTML is not well formed with two style attribute for the <li> tag.

      Attachments

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            martindelylo Martin Delille
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: