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.

    0_1563201867980_0b3668fb-b6dd-4d96-9c33-02de3838e990-image.png

    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.

    model[val1*val2][val3].val

    TableViewColumn example of what i want (4 column):

                        TableViewColumn {
                        id: fourColumn
                        horizontalAlignment: Text.AlignHCenter
                        title: qsTr("teste")
                        width: 100
                        movable: false
                        resizable: false
                        delegate:
                            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 {
                                    id:testAddress
                                    objectName: "test_address"
                                    anchors.top:parent.top
                                    anchors.centerIn: parent
                                    linkedData: table.ldata(styleData)
                                    from: 0
                                    to: 100
                                    editable: true
                                    implicitWidth: 0
                                    implicitHeight: 0
                                    height: globals.table.rowHeight-2
                                    width:parent.width-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



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