Comment 7 for bug 1243395

Revision history for this message
Kevin Wright (kevin-wright-1) wrote :

Regarding https://bugs.launchpad.net/u1db-qt/+bug/1243395/comments/2, that sounds a little bit similar to doing this:

delegate: Item{
                width: 180; height: 50
                Text {
                    text: name + ": " + number
                }
                MouseArea {
                    anchors.fill: parent
                    onClicked:{parent.parent=null}
                }
            }

Which will also result in an empty item in a ListView, rather than deleting or removing it.

Assuming "contactmodel" is the model used by the ListView, something more like this will remove the item:

delegate: Item{
                width: 180; height: 50
                Text {
                    text: name + ": " + number
                }
                MouseArea {
                    anchors.fill: parent
                    onClicked:{contactmodel.remove(parent.parent.index)}
                }
            }

The Item needs to be removed from the model, not simply made null.