On Wed, 29 Mar 2000, Simon Green wrote:

<...>

> Are there any known problems with it, or is there some gotcha I haven't
> seen in the documentation? As far as I can see, I only need to create
> it, possibly move/size/otherwise pretty-fy, insert the QListViewItems I
> want using insertItem(), and then show() it. Am I missing something?

Well, that's a curious tale. If you look at the code below, and execute
it with the latest PyKDE/PyQt, you'll find it works without any problems,
and withtout insertItem(), either. Would you care to share your code 
with us?

-----------

#!/usr/bin/env python

import sys
from qt import *
from kdecore import *
from kdeui import *
#from kde import *

TB_QUIT = 5
TRUE=1
FALSE=0
ID_HINTTEXT=1

class myListView(QListView):

  def __init__(self, parent):
    QListView.__init__(self, parent) 
    self.rows=[] # always keep a local reference to your listviewitems.
    self.setAllColumnsShowFocus(TRUE)
    
    self.addColumn('xxxx', 100)
    self.addColumn('xxxxxxxxxxxxx', 100)
    self.addColumn('xxxxx', 200)
    self.addColumn('xxxxxxxx', 100)    

    self.rows.append( QListViewItem(self, 'a', 'a', 'a', 'a'))
    self.rows.append( QListViewItem(self, 'b', 'b', 'b', 'b'))
    self.rows.append( QListViewItem(self, 'c', 'c', 'c', 'c'))
       
class Win(KTMainWindow):

  def __init__(self, *args):
    apply(KTMainWindow.__init__,(self,)+args)
    
    self.view=myListView(self)
    self.setView(self.view)
    self.view.show()
    self.view.setFocus()
                       
def main():
  app=KApplication(sys.argv,"listview")
  toplevel=Win()
  app.setMainWidget(toplevel)
  toplevel.show()
  app.exec_loop()
  
  
if __name__=="__main__":
  main()

----------------

>
> BTW: thanks to Phil Thompson and Boudewijn Rempt for the excellent work
> porting the lib and writing the tutorial! (Without either of which, of
> course, I wouldn't have got as far as I did!).

<blush/>






Reply via email to