Chez
28th June 2010, 16:58
Hi, All.
My name is Chez, I'm new here and this is my first post on these forums, so hope the newbie section is the correct place...I'm an absolute beginner with QT as well.
I'm using pyqt with Python 2.6 in a deb environment.
Short Question: How do I select an item in a single column QListView class using setSelection...
Some details:
I have a QListView class called listBox. I fill the QlistView with a model (simple list of one column data) called listModel...this is made up of a pure python list.
I have a python class for my list handling, of which one of the methods deletes multiple occurrences of items in the list. On the pyqt side I am using a Signal for changing selection :
self.connect(self.listBox.selectionModel(),SIGNAL("selectionChanged(QItemSelection, QItemSelection)"),self.slot)
and a method called slot...this is all ok...
However, long story short, what I want to be able to do is change the selected item in the QListView class listBox after I have deleted items from the model. I have looked at setSelection but I really have no clue what I am doing here, so any help would be useful.
List = [One, Two, One, Two, Three, One]
I want to via code select any item in the list....so that it is highlighted.
Thanks for any help you can provide.
p.s. A definitive example would be appreciated...
My name is Chez, I'm new here and this is my first post on these forums, so hope the newbie section is the correct place...I'm an absolute beginner with QT as well.
I'm using pyqt with Python 2.6 in a deb environment.
Short Question: How do I select an item in a single column QListView class using setSelection...
Some details:
I have a QListView class called listBox. I fill the QlistView with a model (simple list of one column data) called listModel...this is made up of a pure python list.
I have a python class for my list handling, of which one of the methods deletes multiple occurrences of items in the list. On the pyqt side I am using a Signal for changing selection :
self.connect(self.listBox.selectionModel(),SIGNAL("selectionChanged(QItemSelection, QItemSelection)"),self.slot)
and a method called slot...this is all ok...
However, long story short, what I want to be able to do is change the selected item in the QListView class listBox after I have deleted items from the model. I have looked at setSelection but I really have no clue what I am doing here, so any help would be useful.
List = [One, Two, One, Two, Three, One]
I want to via code select any item in the list....so that it is highlighted.
Thanks for any help you can provide.
p.s. A definitive example would be appreciated...