[SOLVED] Function in listview
-
Hi,
I have my list view
@ ListView {
id: groupList
anchors.fill: parentmodel: ContactModel6 {} delegate: RowGroup {} }@
and my item
@Rectangle {
id: rowGroupRectangle { id: rectRowGroup TextEdit { id: bigtitle text: title }
function switchtitle(t)
{
bigtitle.text = t;
}
}@I want to access to my function switchtitle to item number 2
How i can do this?I try @groupList.pos(3).switchtitle("new title")@ but that don't work
Thx
EDIT: moved to QtQuick, Gerolf
-
Hi,
You can't access to a ListView Item through this utopic pos() because ListView's items are instancied and deleted dynamicaly when you scroll the area, for performances purpose (that's why there is only a "currentItem" property and not anything else).
I suggest you to remove your unneeeded switchtitle() function and to replace :
@groupList.pos(3).switchtitle("new title")@
By :
@groupList.model.get(3).title = "new title";@
-
Thx.
I can't access a function?
-
You can't access a delate, and that includes functions of that delegate.