Qt6 topics merged with General

how to align Listview header items with content position

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



  • Moderators

    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...

  • 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

Log in to reply