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

QML Text component does not clip properly when width is 0 and elide is not None

    XMLWordPrintable

Details

    • I0c4aafbcc50343bb0ec8b5f335045e1048a499fd

    Description

      When a value other than ElideNone is specified for a Text component, it is implied that the string will be elided and effectively clipped to the explicit width of the Text object. This works correctly until you enter a width of 0 at which time Text falls back to the implicitWidth automatically. This results in a component with a width of 0, and an implicitWidth > 0, and the text is rendered with no ellipses at full length.

      Text {
          width: 0
          elide: Text.ElideRight
          text: "Some text that should be elided and clipped"
      
          Component.onCompleted: console.log( "Width: " + width + " implicitWidth: " + implicitWidth )
      }
      

      If you give the Text a non-zero value for width, even 0.5 the string is correctly clipped.

      Attachments

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

        Activity

          People

            kahautam Kari Hautamäki
            leonard777 Corey Pendleton
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes