I am trying to automate a PyQt based application that uses a QListView in icon mode using Squish Inorder to select a specific item in the view, i need to first identify the text of the item. I am using the below code to do the same
targetList = waitForObject("{name='someListView' type='QListView'}")
object.children(targetList)[11].model().data(object.children(targetList)[11]).toString()
Here object.children(targetList)[11] is of type QModelIndex
But the above code always returns an empty string.
Is there any other way to retrieve the text data
I would rather use QListView
API only. So, in case of valid targetList
object, i.e. it's found by waitForObject
function, I would write:
targetList = waitForObject("{name='someListView' type='QListView'}")
model = targetList.model()
col = targetList.modelColumn
idx = model.index(11, col)
itemString = idx.data().toString()