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

Add text eliding for textFormat: Text.RichText

    XMLWordPrintable

Details

    Description

      Eliding is only applied for plain text. Once AutoText changes to anything other than PlainText - or if any other values than PlainText is set, eliding is ignored.

      This was documented to be a limitation in 736a73ac, however it's not apparent from the documentation how to achieve eliding with RichText which is a requirement in many cases.

      import QtQuick 1.0
      
      Rectangle {
          width: 132; height: 132
      
          Column {
              anchors.fill: parent
      
              Text {
                  id: workingText
                  width: parent.width
                  text: "THIS IS TEST----------------------------------------------------"
                  elide: Text.ElideRight
                  font.pixelSize: 22
              }
              Text {
                  width: parent.width
                  text:  "workingText is " + workingText.width +"px wide"
              }
      
              // This doesn't work:
              Text {
                  id: brokenText
                  width: parent.width
                  text: "<b>"+workingText.text+"</b>"
                  elide: Text.ElideRight
                  textFormat: Text.PlainText
                  font.pixelSize: 22
              }
              Text {
                  width: parent.width
                  text:  "brokenText is " + brokenText.width +"px wide"
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              bodson Yann Bodson (Inactive)
              hhartz Henrik Hartz (closed Nokia identity) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes