[PyKDE] Inheritance not supported?

marvelan L marvelan at hotmail.com
Thu Jan 23 14:58:00 GMT 2003


Hi,

I'm trying to use my own subclassed QPixmap in a QComboBox. But it
seems that the QComboBox.pixmap method just returns the base class
and not my sub class!

Does not PyQt support the use of subclassed Qt objects?

This seems like a bug in PyQt to me?!?


An example... The following should print MyPixmap and not qt.QPixmap:

from qt import *
import sys

class MyPixmap(QPixmap):

    def __init__(self):
        QPixmap.__init__(self)

app = QApplication(sys.argv)
main = QMainWindow()
main.setGeometry(0,0,400,400)
app.setMainWidget(main)

combo = QComboBox(main)
combo.insertItem( MyPixmap(), "One")

mypixmap = combo.pixmap(0)

print "MyPixmap?", mypixmap, mypixmap.__class__

main.show()
app.exec_loop()

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the PyQt mailing list