Results 1 to 3 of 3

Thread: How to set all the labels transparent using "QLabel{background:transparent}" ?

  1. #1
    Join Date
    Apr 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default How to set all the labels transparent using "QLabel{background:transparent}" ?

    qApp->setStyleSheet("QLabel{background:transparent}") ;
    lab2->setStyleSheet("background:transparent");
    When I use these two statements above, there are different effects to the labels:

    label.jpg

    The first statement can't make the labels transparent. And I need to know that how to make all the labels transparent when there's a background-image on the QMainWindow?

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

    Default Re: How to set all the labels transparent using "QLabel{background:transparent}" ?

    Make sure autoFillBackground property of the label is set to false.
    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. #3
    Join Date
    Apr 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to set all the labels transparent using "QLabel{background:transparent}" ?

    Thank you, wysota. I checked it again that the autoFillBackground property of the label is false. And now I set the background-image of the mainwindow in qss not in Qt-designer and this problem is disappeared.

Similar Threads

  1. Replies: 0
    Last Post: 24th November 2012, 12:44
  2. Replies: 1
    Last Post: 22nd January 2010, 15:45
  3. Replies: 1
    Last Post: 18th August 2008, 16:10
  4. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 03:10
  5. Replies: 1
    Last Post: 5th April 2006, 17:44

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.