Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
PySIde - generatedIconPixmap
JoNo_21 last edited by
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?