Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-29

horizontalAlignment property in Text does not perform as expect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • Qt for MCUs 1.9
    • Qt for MCUs 1.6
    • Font Engine
    • None
    • Windows
    • 0
    • c1a241d2e164a28a289ee83dac33756066ac2fb1
    • QUL Sprint 1.5/2021, QUL Sprint 2.1/2021, QUL Sprint 2.2/2021, QUL Sprint 2.3/2021

    Description

      Here is the code snippet:

      // code placeholder
      Rectangle {
          width: 480
          height: 272   
       Text {
              id:text1
              anchors.centerIn: parent
              width: 200
              color: "salmon"
              text: "Hello World!\ntext\nthis is a test!"
              font.pixelSize: 24
              horizontalAlignment: Text.AlignHCenter
          }
          Text {
              anchors.centerIn: parent
              width: 200
              anchors.top: text1.bottom
              color: "salmon"
              text: "Hello World!\ntext\nthis is a test!"
              font.pixelSize: 24
      //        horizontalAlignment: Text.AlignHCenter
          }
      }
      

       

      Here is the screenshot:

       

      You can see the text is not in horizontal center. When in normal Qt, it looks like this:

       

      // code placeholder
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
          Item{
              anchors.fill: parent
              Text {
                  id: name
                  anchors.horizontalCenter: parent.horizontalCenter
                  text: qsTr("Hello World!\ntext\nthis is a test!")
                  horizontalAlignment: Text.AlignHCenter
              }
          }
      
      
      }
      

        

       

      Attachments

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

        Activity

          People

            hubert.liberacki Hubert Liberacki
            yorkchenqt1989 York Chen
            Daniel Drozdz Daniel Drozdz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes