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

QML Text - Wrong implicitWidth

XMLWordPrintable

    • Android, iOS/tvOS/watchOS, Windows
    • 52b5aaaab (dev), 182624225 (6.9), b4b4fc74c (6.8)

      Using the minimal example below shows a weird behavior of the implicitWidth of Text.
      It looks like Windows is affected when a screen scaling of 100% is used in the windows settings:

      With 150% or another scaling, everything works fine:

      Our expectation is, that implicitWidth always reports the width of the text as single line text with no line breaks.
      Edit: Android ist also affected in general while on iOS the behavior on iOS depends on the font size.

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      ApplicationWindow {
          color: "lightgreen"
          height: 300
          visible: true
          width: 400
      
          ColumnLayout {
              anchors.fill: parent
      
              Text {
                  id: testing
      
                  text: "A long text to show the behavior with RichText."
                  textFormat: Text.RichText
                  wrapMode: Text.Wrap
              }
              Text {
                  text: testing.implicitWidth
              }
          }
      }
      

        1. scaling100.png
          scaling100.png
          7 kB
        2. scaling150.png
          scaling150.png
          13 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            morteza.jamshidi Morteza Jamshidi
            larss Lars Schmertmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes