I have made it to work, I don't know if there is an easier way of doing it but this is the way I have done it...
I changed the button like this (pythonList is the id of the ListView.)
@onClicked:{ controller.rollDice(pythonList.currentIndex)}@
in python controller class i did this:
@QtCore.Slot(int)
def rollDice(self,currentindex):
wrappedPlayers[currentindex].setDice()@
and in the wrapper I did this:
@def setDice(self):
tmp=random.randint(1,6)
print tmp
self._player['dice']=tmp
self.changed.emit()
changed = QtCore.Signal()
dice = QtCore.Property(int, _dice,setDice, notify=changed)
#(_dice is the function that just returns the name not used now.)
@
this is what i base my list on:
@players = [{'name':'Jerry','sum':24,'dice':1},{'name':'Jonas','sum':35,'dice':6},{'name':'Ted','sum':29,'dice':4},{'name':'Jimmy','sum':25,'dice':3}]
wrappedPlayers = [Wrapper(player) for player in players]
playerList = playerListModel(wrappedPlayers)
...
rc.setContextProperty('pythonListModel', playerList)@