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

Text: mis-aligned text

    XMLWordPrintable

Details

    • 79cfc8788d6267eeb263983466ba21758f618dcd

    Description

      A certain combination of width/height/implicitWidth/implicitHeight bindings and horizontalAlignment != Text.AlignLeft causes the text to get mis-aligned when the textual content is changed. A simple test case:

      import QtQuick 2.3
      import QtQuick.Window 2.2
      
      Window {
          width: 200
          height: 200
          visible: true
      
          Rectangle {
              border.color: "red"
              anchors.centerIn: parent
              width: label.implicitWidth // note: label.contentWidth works
              height: label.implicitHeight
      
              Text {
                  id: label
                  anchors.fill: parent
                  text: !ma.pressed ? "press me" : "this is mis-aligned"
                  horizontalAlignment: Text.AlignHCenter // or Text.AlignRight
              }
          }
      
          MouseArea {
              id: ma
              anchors.fill: parent
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              jpnurmi J-P Nurmi
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes