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

How to handle a row click in TableView 2.0?



  • How to handle a row click in TableView 2.0?

    I use DelegateChooser with different delegates for all coulmns:

        TableView {
            id: table
            anchors.fill: parent
            columnSpacing: 1
            rowSpacing: 3
            clip: true
    
            property var columnWidths: [100, 90, 90, 60, 60];
            columnWidthProvider: function (column) { return columnWidths[column] }
    
            delegate: DelegateChooser {
                role: "type"
                DelegateChoice {
                    roleValue: "pair"
                    delegate: Text { ...
                    }
                }
                DelegateChoice {
                    roleValue: "price"
                    delegate: Text { ...
                    }
                }
                ...
    

    but need to handle a click not on a particular cell, but on entire row and access the row data from the click handler. How to implement this?


Log in to reply