-3

my qml:

if i create a button and call " _model.writeapp(appname);" from its click event it works fine, but not from the listview checkbox oncheckedchanged event

context is defined

Container {
ListView {
    id: listid
    dataModel: _model

    function getAppName() {
        return (_model.readApp());
    }

    function writeappName(appname) {
        _model.writeapp(appname);
    }
    //! [1]

    listItemComponents: [
        ListItemComponent {
            id: listcomp
            type: "item"
            Container {
                id: conchk
                CheckBox {
                    id: chkbx
                    text: ListItemData.appname
                    onCheckedChanged: {
                        console.log("checked")
                        if (checked) {
                            //have to call     _model.writeapp(appname);
                            chkbx.ListItem.view.writeappName("hi")                                
                        }
                    }
                }
            }
        }
    ]
}

}

StanK
  • 4,750
  • 2
  • 22
  • 46
Neha
  • 1
  • 1

1 Answers1

1

Try changing this:

chkbx.ListItem.view.writeappName("hi")

To this:

conchk.ListItem.view.writeappName("hi")
Scott
  • 552
  • 3
  • 7