pyQT question

Scott Hathaway slhath at charter.net
Thu Oct 31 15:41:54 EST 2002


Thanks Jim!  That worked.

Scott

"Jim" <jbublitzNO at SPAMnwinternet.com> wrote in message
news:3DC0B3A8.7060805 at SPAMnwinternet.com...
> Scott Hathaway wrote:
> > I am new to pyQT and I am trying to subclass this form and add items to
the
> > listbox.  Can anyone tell me what I am doing wrong?
>
> >         self.dbList = QListView(self,'dbList')
>
>
> >         self.dbList.insertStrList(dbs)
> >         # here I have tried the following
> >         # frmMain.dbList.insertItem(dbs[0])
> >         # mForm.dbList.insertItem('test')
>
> 'insertStrList' is a QList*Box* method, not QList*View*.
> QListView.insertItem takes a QListViewItem, not a
> string. A QListBox holds a list of strings, a QListView
> holds a list of QListViewItems. The similarity in
> names is a little confusing.
>
> lvItem = QListViewItem (self.dbList, "test")
>
> should be all you need if you really want QListView.
> You don't really need the "lvItem =" either, unless
> you want to access the particular QListViewItem directly
>   - the  constructor should insert it in the parent
> (self.dbList), and the parent holds a reference to
> the QListViewItem created.
>
> Hopefully I read my own code correctly - if not,
> the Qt docs are very good and you should consult those.
>
>
> Jim
>
>
>
>





More information about the Python-list mailing list