Results 1 to 2 of 2

Thread: QPushButton with semi-transparent image

  1. #1
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default QPushButton with semi-transparent image

    I need to place the image with semi-transparent shadow on the QPushButton. When I try to do this, I still see the buttons background through the semi transparent areas of that image. Is there any way to achieve this other than subclassing QPushButton and reimplementing paintEvent? Also I'd like to avoid applying stylesheets.

    I've noticed it works when I set the image as the brush for the button's background role when the button is flat. But background appears again when I click it.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPushButton with semi-transparent image

    Subclassing is the best way to go.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    mentalmushroom (25th June 2012)

Similar Threads

  1. Placing a transparent image on a QPushButton
    By Luc4 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd February 2010, 09:21
  2. Can QDockWidget be semi-transparent?
    By PolyVox in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2009, 20:09
  3. Non-transparent QWidget on semi-transparent parent
    By EuroElessar in forum Qt Programming
    Replies: 0
    Last Post: 29th August 2008, 16:20
  4. Semi-Transparent Background on Widget?
    By JimDaniel in forum Qt Programming
    Replies: 3
    Last Post: 16th January 2008, 18:19
  5. Semi transparent QDialog
    By cs_raja in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 10:14

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.