Results 1 to 2 of 2

Thread: icon modes and mask for checkable pushbutton question

  1. #1
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default icon modes and mask for checkable pushbutton question

    I have an image I want to use as a button:
    I also a modified (rotated) version of the image that I want to use for when the button is actively being pressed, and another for when the button is "checked".
    I have two problems. First, when the button is pressed it correctly shows the "active" icon, however it doesn't switched to the appropriate "checked" or "unchecked" icon until the button loses focus. I can set the focus policy to NoFocus, but then the active mode never occurs.
    Here is my code
    Qt Code:
    1. icon.addFile("..\\sb\\images\\collapseArrow.png", size, QIcon::Normal, QIcon::Off);
    2. icon.addFile("..\\sb\\images\\collapseArrow.png", size, QIcon::Selected, QIcon::Off);
    3. icon.addFile("..\\sb\\images\\collapseArrowActive.png", size, QIcon::Active, QIcon::Off);
    4. icon.addFile("..\\sb\\images\\collapseArrowActive.png", size, QIcon::Active, QIcon::On);
    5. icon.addFile("..\\sb\\images\\collapseArrowCollapsed.png", size, QIcon::Normal, QIcon::On);
    6. icon.addFile("..\\sb\\images\\collapseArrowCollapsed.png", size, QIcon::Selected, QIcon::On);
    To copy to clipboard, switch view to plain text mode 

    Second, I ONLY want the icon to display for the button, I don't want to see the button border (see image below) or see it shaded when its pressed, etc. Normally I would use a mask created from the same image used for the button. However, I a) want the clickable region to be larger than the image and the image changes as described above.


    Thanks for any help you guys can give me

  2. #2
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: icon modes and mask for checkable pushbutton question

    Since I wanted the clickable region to be larger than the icon anyway, I just used a label instead of a button, and handled the mouse events myself

Similar Threads

  1. PushButton Icon Location
    By jftaylor21 in forum Qt Programming
    Replies: 1
    Last Post: 18th October 2009, 16:46
  2. add an icon to a pushbutton
    By sophister in forum Qt Programming
    Replies: 8
    Last Post: 25th June 2009, 10:50
  3. How to get pushbutton as an icon
    By Pembar in forum Newbie
    Replies: 1
    Last Post: 12th May 2009, 19:59
  4. Question on checkable QStandardItem in QTreeView
    By ttvo in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 00:30
  5. Checkable Action Icon
    By zgulser in forum Qt Tools
    Replies: 8
    Last Post: 15th January 2009, 13:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.