Hi,

I'm struggling to understand how to use QIconFactory. I can't seem to get createPixmap() in my subclassed QIconFactory called in a situation where, as far as I understand the docs, it should be called. Below is some sample code that demonstrates my problem.

Have I misunderstood how to use QIconFactory (of perhaps QIconSet?) or does the problem lie deeper (i.e., in PyQt)?

Any help would be much appreciated!

//Fredrik

---- test.py ----
import qt
import sys

class MyIconFactory(qt.QIconFactory):
    """
    My own QIconFactory. Always gives a null QPixmap.
    """
    def __init__(self):
        qt.QIconFactory.__init__(self)

    def createPixmap(self, iconset, size, mode, state):
        print 'in createPixmap()' # Never gets here
        return qt.QPixmap()

app = qt.QApplication(sys.argv)
mw = qt.QLabel(None)
app.setMainWidget(mw)

# Create an empty QIconSet and install my own brand of icon factory.
# This should ensure that QIconSet uses my createPixmap().
ic = qt.QIconSet()
ic.installIconFactory(MyIconFactory())

mw.setPixmap(ic.pixmap())
mw.show()

app.exec_loop()

_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to