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. Access TableViewItem property in QML TableView

Access TableViewItem property in QML TableView

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 975 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.
  • T Offline
    T Offline
    Tschikkn
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @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)
      }
      

      157

      1 Reply Last reply
      1
      • T Offline
        T Offline
        Tschikkn
        wrote on last edited by
        #3

        Thank you! That will help a lot!

        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