[PyKDE] How to display 'multi-line text' with QListViewItem

Eiji Katagiri katagiri at teikokupr.co.jp
Fri Jun 8 03:59:45 BST 2001


I want to display 'multi-line text' with QListViewItem.
There is a simple example. In this example, I got the
incomplete disply. It seems that setHeight() method
doesn't work. why ?

--

#!/usr/bin/env python
import sys
from qt import *

class ListView(QWidget):
    def __init__(self, *args): 
        apply(QWidget.__init__, (self,)+args)
        self.setCaption('multi-line')
        listview = QListView(self, 'listview')
        listview.addColumn('Contents')
        item = QListViewItem(listview, '1st line\n2nd line')
        item.setHeight(40)
        sz = listview.sizeHint()
        listview.resize(sz.width(), sz.height())

a = QApplication(sys.argv)
w = ListView()
a.setMainWidget(w)
w.show()
a.exec_loop()

--

Thanks for any help,

Eiji Katagiri






More information about the PyQt mailing list