-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")                                
                        }
                    }
                }
            }
        }
    ]
}

}

4

1 回答 1

1

尝试改变这个:

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

对此:

conchk.ListItem.view.writeappName("hi")
于 2013-08-14T21:22:15.140 回答