Results 1 to 5 of 5

Thread: Insert an image with transparent background on base background

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Insert an image with transparent background on base background

    Hello Everybody!
    I'm a newbie of Qt. I have a problem need help. I want insert an image with transparent background (icon-home.png) in to a window which I created.
    This window I set background by follow command:

    Qt Code:
    1. window->setStyleSheet("background-image: url(./images/bg.jpg");
    To copy to clipboard, switch view to plain text mode 

    Image I insert by:
    Qt Code:
    1. QLabel *image = new QLabel;
    2. image->setPixmap(QPixmap("./images/icon-home.png"));
    To copy to clipboard, switch view to plain text mode 

    Then:
    Qt Code:
    1. layout->addWidget(image);
    2. window->setLayout(layout);
    To copy to clipboard, switch view to plain text mode 

    but when program run, the area transparent of image haven't color of base background (otherwise, the area stransparent of image cover base background).
    How to make this area transparent dont cover base background ?
    Thanks!
    Attached Images Attached Images
    Last edited by mrphunghuy; 31st October 2013 at 08:23.

Similar Threads

  1. Transparent Push button over background image
    By KumarKandasamy in forum Newbie
    Replies: 2
    Last Post: 15th May 2014, 07:22
  2. Replies: 0
    Last Post: 5th April 2011, 13:36
  3. Replies: 1
    Last Post: 25th June 2010, 18:31
  4. How to insert an image in background of a Form?
    By awanish_jmi in forum Qt Tools
    Replies: 2
    Last Post: 8th August 2008, 10:52
  5. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 02:10

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.