Important: Please read the Qt Code of Conduct -

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
            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: {

  • Thank you! That will help a lot!

Log in to reply