Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to centre align Items under Column
Forum Updated to NodeBB v4.3 + New Features

How to centre align Items under Column

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 429 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    James A
    wrote on last edited by
    #1

    Hi

    I am trying to centre align the text fields Under QML Column as shown below , but the text fields are always left aligned

     Column {
     
      Text { text: "1" }
      Text { text: "2" }
     
    }
    

    f2faf8d8-d759-4833-aa2e-f2712ad9397d-image.png

    Regards,
    James A

    MarkkyboyM 1 Reply Last reply
    0
    • J James A

      Hi

      I am trying to centre align the text fields Under QML Column as shown below , but the text fields are always left aligned

       Column {
       
        Text { text: "1" }
        Text { text: "2" }
       
      }
      

      f2faf8d8-d759-4833-aa2e-f2712ad9397d-image.png

      Regards,
      James A

      MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2

      Add anchors.horizontalCenter: parent.horizontalCenter to each of your text items and add width: parent.width to Column

              Column {
                  width: parent.width
                  Text { text: "1"; anchors.horizontalCenter: parent.horizontalCenter }
                  Text { text: "2"; anchors.horizontalCenter: parent.horizontalCenter }
              }
      

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      1 Reply Last reply
      1
      • J Offline
        J Offline
        James A
        wrote on last edited by
        #3

        @Markkyboy

        Thanks for helping out. This helped me to fix the problem

        53bef655-1d11-4b02-9129-d3ec4ff8e2ce-image.png

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved