void Widget::on_pushButton_clicked()
{
QTimer *timerOpacity = new QTimer(this);
connect(timerOpacity,SIGNAL(timeout()),this,SLOT(changeOpacity()));
timerOpacity->start(100);
}
void Widget::changeOpacity()
{
if (opalevel > 8) return;
double opacity[9] = {0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1};
ui->stackedWidget->setWindowOpacity(opacity[opalevel]);
ui->widget->setWindowOpacity(opacity[opalevel]);
this->setWindowOpacity(opacity[opalevel]);
qDebug()<<"opalevel = "<< opalevel <<" ui->widget opacity:"<<ui->widget->windowOpacity();
qDebug()<<"opalevel = "<< opalevel <<" ui->stackedWidget opacity:"<<ui->stackedWidget->windowOpacity();
qDebug()<<"opalevel = "<< opalevel <<" ui opacity : "<< this->windowOpacity()<<endl;
}