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

Minimize text relayouts when eliding is active

    XMLWordPrintable

Details

    Description

      import QtQuick 2.0
      
      Rectangle {
          width: 400
          height: 400
      
          property real defaultWidth: txt.implicitWidth
      
          Text {
              id: txt
              text: "hello world"
              width: 100
              elide: Text.ElideRight
          }
      
          MouseArea {
              anchors.fill: parent
              onClicked: txt.width += 10
          }
      }
      
      • In the above example, we do an extra relayout on every click for calculating the implicit width (which does not change)
      • In some cases, we call QFontMetrics::elidedText() with a width <= 0. We should avoid this call (or make elidedText short circuit much more quickly).
        • Alternatively, we could consider taking care of the eliding ourselves (this might also require us handling length variants)

      Attachments

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

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            brasser Michael Brasser (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes