Results 1 to 2 of 2

Thread: Image with transparent backgroung on QLabel

  1. #1
    Join Date
    Jul 2009
    Posts
    40
    Thanks
    7

    Default Image with transparent backgroung on QLabel

    Hi

    I want to set image which have transparent background on my label . But the image is not displayed on the label.

    I i change the background of the image so it is not transparent, then the image is displayed in my label.

    So, what could be the problem with showing image with transparent background ?

    here is the code :
    Qt Code:
    1. QPixmap pix(pathToImg);
    2. myLabel->setPixmap(pix);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Image with transparent backgroung on QLabel

    This is what you've to do :----->

    Qt Code:
    1. myLabel->setStyleSheet("QLabel{ background-color: transparent;}");
    To copy to clipboard, switch view to plain text mode 

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

    elizabeth.h1 (6th June 2012)

Similar Threads

  1. Applying a backgroung image to a widget
    By Stanfillirenfro in forum Qt Programming
    Replies: 7
    Last Post: 17th February 2012, 09:36
  2. Replies: 0
    Last Post: 19th January 2011, 12:49
  3. Replies: 6
    Last Post: 21st September 2009, 10:55
  4. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 02:10
  5. Replies: 1
    Last Post: 5th April 2006, 16:44

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.