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

Qt support for <span> + CSS property <margin> is broken

    XMLWordPrintable

Details

    • 84a618809 (dev)

    Description

      Problem can be observed in both QML Text and QTextEdit. So I suppose it is a problem in Qt support for rich text as a whole.

      So first of all, <margin-*> is a supported property:

      https://doc.qt.io/qt-6/richtext-html-subset.html#css-properties
      

      also <span>

      https://doc.qt.io/qt-6/richtext-html-subset.html#supported-tags
      

      And actually using <span> with most of other CSS properties work just fine - except <margin-*>. 2 reproducers attached: one for QML and one for QWidget. Build with 6.7.2 and run them, then one can see that margin is missing. The same rich text should look like as what a browser shows:

      But actually margin is not there. QTextEdit:

      Quick:

      Actually, one can see that all other properties (color, font, etc.) work correctly. But not <margin-*>.

      Also, the problem seems to be related to combination of <span> and <margin-*>. For example, using <maring-*> like <p style='margin-left: 200px;'> is totally fine.

      Attachments

        1. image-2024-07-23-11-36-48-005.png
          image-2024-07-23-11-36-48-005.png
          174 kB
        2. QTBUG-127457.7z
          2 kB
        3. screenshot-1.png
          screenshot-1.png
          9 kB
        4. screenshot-2.png
          screenshot-2.png
          17 kB
        For Gerrit Dashboard: QTBUG-127457
        # Subject Branch Project Status CR V

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes