Nominate our 2022 Qt Champions!

Is it possible through qml javascript change the value of an delegate of a TableViewColumn?

  • I have a tableview with some columns (TableViewColumn).
    On each row i will have spinbox except the first and last column.


    What i want to do is, when i change the value in the spinbox of the 4 column, i want to change the text on the last column, taking in account the value of the 2,3 and 4 spinbox, then those value will serve as index for a model.


    TableViewColumn example of what i want (4 column):

                        TableViewColumn {
                        id: fourColumn
                        horizontalAlignment: Text.AlignHCenter
                        title: qsTr("teste")
                        width: 100
                        movable: false
                        resizable: false
                            Rectangle {
                                border.width: 1
                                border.color: globals.table.borderColor
                                color: globals.table.borderColor
                                anchors.fill: parent
                                anchors.centerIn: parent
                                width: deviceAddress.implicitWidth+2
                                height: globals.table.rowHeight
                                property var value: "teste"
                                PanelSpinBox {
                                    objectName: "test_address"
                                    anchors.centerIn: parent
                                    linkedData: table.ldata(styleData)
                                    from: 0
                                    to: 100
                                    editable: true
                                    implicitWidth: 0
                                    implicitHeight: 0
                                    height: globals.table.rowHeight-2
                                    onValueModified: {
                                        console.log("row: "+styleData.row+"\n")
                                       //This doesnt work it's just to illustrate
                                        var teste = column[5].index[styleData.row] //to access the component that is on the last column
                                        teste.text = model_teste[column[2].index[styleData.row].value*column[3].index[styleData.row].value][column[4].index[styleData.row].testAddress //to set the text of the component in last column

    note: model_teste is not the model that is associated to TableView