[PyKDE] bug in QListView{Item} height?
Andrew Dalke
adalke at mindspring.com
Mon Apr 29 14:12:00 BST 2002
I'm using 3.0.3 and most recent PyQt and Python. If I insert a
pixmap in a QListView with a hierarchical view, and the size of
the pixmap is higher than the normal size of the row, then the
branch decorations are askew.
I can reproduce the problem by implementing a QListViewItem and
defining my own height()/setup()/setHeight() methods.
I've appended a reproducible to this email. Once open, toggle
the [+/-] box and see the ugliness. Note also that the line
doesn't go up to the text like I would have expected it to do.
I suspect it's a Qt bug and not PyQt bug, but I don't know how
to use the C++ interface so hope that someone here can verify
it for me before I report it to trolltech.
Andrew
dalke at dalkescientific.com
from qt import *
import sys
a = QApplication(sys.argv)
w = QListView()
w.setRootIsDecorated(1)
w.addColumn("ABC")
w.addColumn("DEF")
pix = QPixmap(100, 100)
## Uncomment the next line and there are no problems
#pix = QPixmap(10, 10)
parent1 = QListViewItem(w)
parent1.setText(0, "Parent1")
parent1.setPixmap(1, pix)
child11 = QListViewItem(parent1)
child11.setText(0, "Child11")
child11.setText(1, "blah")
parent2 = QListViewItem(w, parent1)
parent2.setText(0, "Second parent")
parent2.setText(1, "spam")
child21 = QListViewItem(parent2, "col1", "col2")
child22 = QListViewItem(parent2, child21, "last", "the end")
w.setCaption("Blah, blah")
a.setMainWidget(w)
w.show()
a.exec_loop()
More information about the PyQt
mailing list