PDA

View Full Version : Set the transperancy for an image



samir
6th October 2009, 11:50
From mainwindow i'm opening a dialog writing:
SplashScreenDialog *splScrDlg = new SplashScreenDialog(this);
splScrDlg->show();

I'm opening and showing an image [for splash screen] writing
QPalette palette;
QPixmap pixMap("army.jpg");
QSize size(this->height(), this->width());
QPixmap pixMapScaled(pixMap.scaled(size));
palette.setBrush(QPalette::Background, pixMapScaled);
this->setPalette(palette);

Now i want to control the opacity[or transparency] of this image, i wan to make it transparent as time goes by[an splash screen behaviour].

How to do it ?

yogeshgokul
6th October 2009, 12:29
Call this function:

splScrDlg->setWindowOpacity (0.5);

aamer4yu
6th October 2009, 13:09
Call this function:

splScrDlg->setWindowOpacity (0.5);
In a loop probably...
something like -


// on timer event...
splScrDlg->setWindowOpacity( 1 - (time / duration) );