Question

I am trying to do an easy application MainWindow where I have one Pushbutton. After It's clicked QDialog its opened. I want to make QDialog transparent but it is not working.

void MainWindow::on_pushButton_clicked()
{
QDialog *qd = new QDialog();
//QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect;
//opacityEffect->setOpacity(0.5);
//qd->setGraphicsEffect(opacityEffect);

qd->setFixedSize(this->width(),this->height());

//qd->setPalette(QPalette(QPalette::Window,QColor(0,0,0,128)));
//setAttribute(Qt::WA_TranslucentBackground);
//qd->setWindowFlags(Qt::FramelessWindowHint);
//setWindowFlags(Qt::FramelessWindowHint);

this->setWindowOpacity(0.5);//this actually works
qd->setWindowOpacity(0.5);  //this is not working

//qd->setStyleSheet("background:transparent;background-color:rgba(0,0,0‌​,95)");
// qd->repaint();
qd->show();
}

All the rest is simple GUI project, and pushbutton with slot clicked() added. Is it possible to make QDialog transparent? I left commented lines to see how i was trying to do but no effects.

This was a problem with qt 5.1.0 I already posted as a bug and status is resolved so in new version everything will be all right.

Was it helpful?

Solution

This was a problem with qt 5.1.0 I already posted as a bug and status is resolved so in new version everything will be all right.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top