Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Semi-transparent box around QPixmap PNG that has transparency



  • I'm trying to display a png that has a transparent background in a label in a dialog box. Here is my code:

    About::About(QWidget *parent) {
        /*
         * About app dialog
         */
    
        ui.setupUi(this);
        this->setFixedSize(230, 252);
        QPixmap pixmap("../Resources/mini-icon.png");
        ui.miniIcon->setPixmap(pixmap);
        ui.miniIcon->repaint();
    }
    

    This dialog window displays correctly, but there is a barely discernible box around the png (shown below). I've verified that the png is indeed transparent in Photoshop. The dimensions of the semi-transparent box are the same as that of the image file. Have I missed a step?

    Screen Shot 2020-09-16 at 10.13.21 AM.png


Log in to reply