Results 1 to 2 of 2

Thread: Qt Designer Transparent Image Background Color Issue

  1. #1
    Join Date
    Jun 2021
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt Designer Transparent Image Background Color Issue

    I'm building a simple screen. I've added a couple of layouts to organize it. Like so: https://imgur.com/a/61mqDBp
    I changed the MainWindow's background to an image through the styleSheet property

    Qt Code:
    1. background-image: url(:/MainBackground/MM_Main_Background.png);\nbackground-color: transparent
    To copy to clipboard, switch view to plain text mode 

    The transparent line was an attempt to fix the issue. Doesn't change anything.

    I then added three objects to the top horizontal layout
    - a Label
    - a lineEdit
    - a Label
    I used pixmap and added an image to both labels. Both of the images have transparent backgrounds. I was expecting the images to have the correct background color based on their location, but it seems that they keep the color of the background's left side. I've tried changing their properties to be transparent, changed centralWidget and MainWindow's colors but no dice. I did this based on my Google search results but I have not found something concrete/similar to my problem. I'm probably not searching well enough but I don't know how to best word my problem.

    Thanks in advance to anyone that reads this.

    Empty.ui

  2. #2
    Join Date
    Jun 2021
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt Designer Transparent Image Background Color Issue

    For anyone that has a similar problem. The solution was the following: use styleSheet instead of pixmap. When you add the image, make it a background image not just a normal image. If you had an empty label with no text, this might make the label 'disappear.' Change the sizePolicy to minimum and change the minimumSize to what you need.

Similar Threads

  1. Snap openGL image with transparent background
    By aftos in forum Qt Programming
    Replies: 1
    Last Post: 1st July 2014, 10:28
  2. Transparent Push button over background image
    By KumarKandasamy in forum Newbie
    Replies: 2
    Last Post: 15th May 2014, 07:22
  3. Replies: 8
    Last Post: 10th December 2013, 13:31
  4. Replies: 4
    Last Post: 27th November 2013, 15:15
  5. Replies: 0
    Last Post: 25th August 2010, 17:39

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.