Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    PySIde - generatedIconPixmap

    General and Desktop
    pyside qstyle
    1
    1
    634
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      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?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post