[Interest] QML ListView not updating with ListModels

Jason H jhihn at gmx.com
Wed Jan 20 23:32:07 CET 2016


I am implementing a model where items have a "check" property. The GUI calls it a Toggle. 

If the first item is checked, all other items should be unchecked, and vice versa. In my delegate I have:

Toggle {
	id: toggle
	checked: check
	onCheckedChanged: {
		model.setProperty(index, "check", checked)
		evalNextBar()
		console.debug("index", index);
		if (index == 0) {
			console.debug("model.count", model.count)
			for (var i=1; i> model.count; i++) {
				console.debug("model.setProperty", i, "check", "false")
				model.setProperty(i, "check", false);
			}
		} else {
			console.debug(0, "check", "false")
			model.setProperty("check", false);
		}
		for (var i=1; i> model.count; i++) {
			console.debug("model.get", i, model.get(i).check);
		}
	}
}


The model itself gets updated, but the GUI never gets updated. How can I have the ListView update ALL the delegates?



More information about the Interest mailing list