March 2nd, 2004, 12:46 PM
Determining the selected item in a QListView
i have got a listview that i want to use to change the display when a user selects an item from the listview. however, im having problems finding the exact syntax to use.
i thought that the following was the right way to go, but it doesn't print out the value i thought it should:
outputs as: <qt.QListViewItem instance at 0x84f3e3c>
could someone please point me in the right direction.
March 2nd, 2004, 07:29 PM
each item in the list is represented by an instance of the QListViewItem class. so you'll need to call a method of that class to see it's value. I can't remember the exact syntax as it's been a while since I did anything with PyQt, but using this:
will give you a list of all the attributes of that class. from there you should be able to find a method that does what you want. so selectedItem() does return the selected item, just that it's an instance of QListViewItem that you need to do further work with to get your data.
Last edited by rebbit; March 2nd, 2004 at 07:31 PM.
March 3rd, 2004, 09:57 AM
thanks for the help. this is the line that gets the text for the column specified in the brackets in the text() method: