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

QTextDocument html parser does not include line-height tag

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.2.0
    • 4.8.4
    • GUI: Text handling
    • None
    • Windows 7
    • 3fe242781e88224d121ebca730db5ebe4fb98ec6

    Description

      With following code snippet QTextDocument::toHtml does not include line-height tag. When setting the tag with html to QTextDocument line-height is correct.

      #include <QTextDocument>
      #include <QApplication>
      #include <QMessageBox>
      #include <QDebug>
      
      int main(int argc, char* argv[])
      {
         QApplication app(argc, argv);
         const QString htmlIn("<html><head><style type='text/css'>body { line-height: 200%; }</style></head><body><p>testing the line height</p><p>second paragraph at 200%<p></body></html>");
         qDebug() << "Input:" << htmlIn;
         QMessageBox::information(0, "Input HTML with line-height", htmlIn);
         QTextDocument doc;
         doc.setHtml(htmlIn);
         QString fromDoc = doc.toHtml();
         qDebug() << fromDoc;
         QMessageBox::information(0, "Doc HTML loss line-height", fromDoc);
         return 0;
      }
      

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            qtcomsupport Qt Support
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes