[PyKDE] Re: widget like KMail's message list

Eron Lloyd eronlloyd at gmail.com
Sun Sep 4 23:56:11 BST 2005


Matej Cepl wrote:

>Eron Lloyd wrote:
>  
>
>>>I need one just like that for a game to show a list of players, their
>>>rank and status. It looks like QListBox doesn't have the multicolumn
>>>functionality that I am looking for. It allows for multiple columns but
>>>only for displaying items in many columns with a fixed number of rows
>>>instead of a single column with a varying number of rows.
>>>      
>>>
>>Check out QListView and friends. It's a breeze to work with. Note that
>>the API will change for Qt4, though.
>>    
>>
>
>I have a problem just other way around -- I am pretty happy with QListBox,
>except that I would love to use kListViewSearchLine (the list in QListBox
>is getting too long :-)). So I would love to persuade QListView (or rather
>KListView) to look and as much as possible to behave like QListBox (see
>attached; single column without header of the column). Is it possible?
>
>Best,
>
>Matej
>
Sure, just create an empty QListView:

qlv = QListView(*args)
qlv.header().hide()  # you can access the QHeader this way
qlv.addColumn("")  # add your column. which won't need a label (pass 
empty string)

and go from there. Creating a search line should be straightforward, 
connecting it, etc.

Good luck,

Eron




More information about the PyQt mailing list