PySIde - generatedIconPixmap



  • I'd like to be able to create a QPushButton with an image such that when the image is hovered over, a brighter version of the image is displayed. I'm attempting to do this for all of my icon buttons in order to avoid needing two images for each button (highlighted, and normal). In order to do so, my idea is to create a QStyle that overrides the generatedIconPixmap function to return a brighter image when the iconMode is QIcon.Active.

    So here's some code that starts to try and do this in PySide:

    class CustomStyle(QPlastiqueStyle):
        def __init__(self):
            super(CustomStyle, self).__init__()
    
        def generatedIconPixmap(self, iconMode, pixmap, option):
            print _NOL10N("generatedIconPixmap!!!")
    

    and I assign it with:

    button = QPushButton(QIcon("image.png"), "")
    button.setStyle(CustomStyle())
    

    The question is, any idea why generatedIconPixmap never gets called?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.