Access TableViewItem property in QML TableView



  • Hi all!

    I've written a c++ custom QAbstractListModel providing information in qml.

    In QML I've got code like this (shortened)

        TableView {
            id: liVi
           /*properties...etc.*/
            TableViewColumn {
                role: "Titel"
                title: "Title"
                width: 100
            }
            TableViewColumn {
                role: "Content"
                title: "Content"
                width: 200
                visible: false
            } /*...more Columns...*/
    

    Now I want to access the "visible"-Property by clicking on the row or cell "Title". I can get the liVi.currentRow as an integer in an "onClicked:console.log(...), but I do not know how to access the TableViewcolumn "Content". Can anyone give me a hint?

    Thanks in advance!


  • Moderators

    @Tschikkn If I understand correctly getColumn will give you access to that column provided you pass the correct index. Something like:

    onClicked: {
        console.log(liVi.getColumn(1).visible)
    }
    


  • Thank you! That will help a lot!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.