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

Incorrect Text alignment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.7.0
    • None

      Text is seems to be aligned incorrectly in some cases.

      import QtQuick 2.0
      import QtQuick.Controls 1.0
      import QtQuick.Layouts 1.0
      
      ApplicationWindow {
          width: 400
          height: 400
          visible: true
          
          property var settings: [
              {italic: true},
              {letterSpacing: -10},
              {wordSpacing: -30},
              {lineHeight: 0.6} // does not work in old versions of Qt, but OK in Qt 5.7
          ]
          GridLayout {
              anchors.centerIn: parent
              rows: 2
              columns: 2
              Repeater {
                  model: settings
                  Text {
                      Layout.preferredWidth: 150
                      Layout.preferredHeight: 150
                      text: "Text\n123" + (modelData.wordSpacing ? " " : "")
                      clip: true
                      font.pointSize: 40
                      font.italic: modelData.italic || false
                      font.letterSpacing: modelData.letterSpacing || 0
                      font.wordSpacing: modelData.wordSpacing || 0
                      lineHeight: modelData.lineHeight || 1
                      horizontalAlignment: Text.AlignRight
                      verticalAlignment: Text.AlignBottom
                      Rectangle {
                          anchors.fill: parent
                          color: "transparent"
                          border.color: "red"
                          border.width: 1
                      }                
                  }
              }
          }
      }
      

      I expect that text in all cases will not be clipped by bounds.

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

            srutledg Shawn Rutledge
            t.artikov Timur Artikov
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes