Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PySIde - generatedIconPixmap
Forum Updated to NodeBB v4.3 + New Features

PySIde - generatedIconPixmap

Scheduled Pinned Locked Moved General and Desktop
pysideqstyle
1 Posts 1 Posters 723 Views 1 Watching
  • 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 Offline
    J Offline
    JoNo_21
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved