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

QTextDocument is limited to `@media screen`when calling setHtml()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.3.0 Alpha
    • 5.12.12, 5.15.10, 6.1.3, 6.2.1
    • GUI: Text handling
    • None
    • All
    • 2e2f1e2af7 (qt/qtbase/dev) 699e661b2b (qt/qtbase/6.3) 2e2f1e2af7 (qt/tqtc-qtbase/dev) 699e661b2b (qt/tqtc-qtbase/6.3)

    Description

      When an instance of QTextDocument is used for printing or print preview and the corresponding CSS stylesheet contains media rules, all except "screen" are ignored.

      The problem has been reported at
      https://bugs.kde.org/show_bug.cgi?id=417104 and https://bugs.kde.org/show_bug.cgi?id=429469 and reported at
      https://invent.kde.org/office/kmymoney/-/merge_requests/118#note_340020 for further investigation.
      The HTML text underlying the bug reports contains css styles in the following form:

      <style type="text/css">
      ...
      @media screen { }
      @media print { }
      ...
      </style>
      
      

      Based on the call stack of QTextDocument::setHtml(),

      the following was found out: The QCssParser checks this tag in QCssParser::testMedia() and considers it in StyleSelector::styleRulesForNode, but in QTextHtmlParser::declarationsForNode the possible medium is hardcoded to `screen`.

      Attachments

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

        Activity

          People

            rhabacker Ralf Habacker
            rhabacker Ralf Habacker
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes