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. Is it possible through qml javascript change the value of an delegate of a TableViewColumn?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmltableviewtableviewcolumnmodel
1 Posts 1 Posters 455 Views
  • 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.
  • N Offline
    N Offline
    Nmaster88
    wrote on last edited by Nmaster88
    #1

    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

    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