Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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 ?

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

    Thanks


  • 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