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 align Listview header items with content position

how to align Listview header items with content position

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.0k Views 2 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.
  • S Offline
    S Offline
    sancelot
    wrote on last edited by
    #1

    Hi,
    In the next image , how can I retrieve the position of my contentitems in order to align header components with it ?

    734c318a-dc81-4947-9161-c3c233ea7ad0-image.png

    Thanks

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      How can we guess based just on an image? Please show us some code!

      My guesses:

      • you can use topComponentId.children[i].width in your rows to get the column width for all columns and to align them manually
      • you can use TableView - it will align everything automatically
      • you can use GridView - it will also align everything automatically

      But I'm only guessing...

      (Z(:^

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sancelot
        wrote on last edited by sancelot
        #3

        I used

        ListView {
        id : listView
        header {
           Image {
             x:  listView.currentItem.x_.x
         }
           Image {
             x:  listView.currentItem.y_.x
         }
           Image {
             x:  listView.currentItem.z_.x
         }
        // ...
        
        }
        

        where x_,y_, z_ are delegate items in this example

        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