Reputation: 9634
i am new to QT, i got to know how to load a simple image on a window. i want to know how to make transparent?.
please tell me the way to achieve it.
Thanks
Upvotes: 2
Views: 5778
Reputation: 31
This is how I did it:
canvas = new QImage(":/Zuerich.jpg");
city = new QImage(canvas->size(),QImage::Format_ARGB32);
QPainter p(city);
p.setOpacity(0.1);
p.drawImage(0,0,*canvas);
p.end();
// the proof:
QRgb pix = city->pixel(10,10);
qDebug() << "Alpha" << qAlpha(pix);
Upvotes: 3