Results 1 to 3 of 3

Thread: QPushButton Icon opacity/transparency

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QPushButton Icon opacity/transparency

    I think you will need to design your icons with an alpha channel. That is how Qt controls transparency. So when you want your button's icon to be transparent, you will either have to change the alpha for the icon or load a new icon with the correct alpha.

  2. #2
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: QPushButton Icon opacity/transparency

    Thanks for a quick reply. I have already looked into creating semi-transparent icons for buttons and using that.

    Here is what I have done so far. (see attched image) opacity.png

    I have created QWidget subclass "ControlButtons" with window opacity set to .3, and when running this widget by itself it semi-transparent. All objects in this widget are transparent including buttons and button icons. But when adding this subclass widget into a parent widget, all opacity settings are lost.
    Qt Code:
    1. ControlButtons *cb = new ControlButtons(this);
    2. cb->setGeometry(10,10,cb->width(),cb->height());
    To copy to clipboard, switch view to plain text mode 
    Is there a way to set opacity to child widget and leave parent widget opacity by default?

Similar Threads

  1. Replies: 9
    Last Post: 8th November 2011, 15:54
  2. Replies: 3
    Last Post: 8th September 2011, 15:45
  3. Change Opacity of QPushButton
    By DiamonDogX in forum Qt Programming
    Replies: 3
    Last Post: 5th November 2010, 12:09
  4. How stretch icon in QPushButton?
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2010, 08:54
  5. Tree selection - icon transparency (lack of)
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 8th January 2008, 21:48

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
  •  
Qt is a trademark of The Qt Company.