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

Text layout is broken if it contains inline images and eliding is used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2, 6.2.4, 6.5.3, 6.6.2
    • None
    • Windows 10, MSVC 2019
    • All

    Description

      Text layout is broken if it contains inline images and eliding is used

      import QtQuick 2.15
      import QtQuick.Window 2.15
      
      Window {
          width: 640
          height: 480
      
          visible: true
      
          readonly property string smile: "<img src='qrc:/(smile).png' width='18' height='18'/>"
      
          Rectangle {
              anchors.fill: text
              color: 'grey'
              opacity: 0.2
          }
      
          Text {
              id: text
              anchors.centerIn: parent
              width: 80
              text: smile + smile + smile + smile + smile + smile + smile + smile + smile + smile + smile
              elide: Text.ElideRight
              maximumLineCount: 2
              wrapMode: Text.Wrap
          }
      }
      

      See attached example for repro.

      Attachments

        1. image-2021-10-15-12-49-04-535.png
          10 kB
          Vladimir Belyavsky
        2. TextIssue.zip
          3 kB
          Vladimir Belyavsky

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              studiosus Vladimir Belyavsky
              Votes:
              9 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes