[PyKDE] Re: Shading after QListView.setSelected()

Hans-Peter Jansen hpj at urpla.net
Tue Mar 29 17:26:13 BST 2005


Hi Jeffrey,

On Tuesday 29 March 2005 18:02, Jeffrey Barish wrote:
> Phil Thompson wrote:
> >
> > Can you post a small, complete example that demonstrate's the
> > problem - and the text of the exception?

> class MyListView(QListView):
> [...]
>     def getSelections(self):
> [...]
>         for thing in self.things:
>             lvi = MyListViewItem(self, thing['data'])
>             for col, key in zip(range(len(self.keys)), self.keys):
>                 lvi.setText(col, thing['text'])
>
>         self.setSelected(self.firstChild(), True)
>         self.firstChild().setEnabled(True)  # produces
> AttributeError
>
> class MyListViewItem(QListViewItem):
>     def __init__(self, parent, data):
>         QListViewItem.__init__(self, parent)
>         self.data = data
>
>     def getItemData(self):
>         return self.data

Since your sample code isn't complete in this form, it's hard to tell 
you _anything_. Do you really expect us to form something runable 
from your artefacts to prove you right or wrong? 

Pete




More information about the PyQt mailing list