QLabel does not correctly display .PNG transparency



  • I just upgraded from Qt 5.1.1 fto Qt 5.5.x. When using 5.1.1, I can overlay labels containing .png images over other labels or frames containing .png images and the transparency of the images is correctly displayed. When I compile the same code using 5.5.x, the images now have a solid colored square around them, where that area should be transparent. Is there a QLabel setting that has changed its default value since 5.1.1? I am using Qt Creator to configure the window and .setStyleSheet to display them.

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    QString frameStyle = "QFrame {border-image: url(CLIENTRUN/IMAGE_FILES/background_layer_bottom.png)};";
    ui->frame->setStyleSheet(frameStyle);
    
    QString label1Style = "QLabel { border-image: url(CLIENTRUN/IMAGE_FILES/tuxvader.png) };";
    ui->textlabel1->setStyleSheet(label1Style);
    
    QString label2Style = "border-image: url(CLIENTRUN/IMAGE_FILES/tuxreaper.png);";
    ui->textlabel2->setStyleSheet(label2Style);
    

    }


  • Qt Champions 2016

    hi
    Qt5.5 , 2 labels assigning png directly to Pixmap seems to work fine.
    http://postimg.org/image/mmukajusf/

    For test did you try a new project and load the png directly and see if the result is the same?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.