Reputation: 361
I have QMDIArea and inside it I have added a QMDISubWindow. I need QMDIArea to be completely transparent. By default it is displayed in grey color.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QMdiArea area = new QMdiArea();
area->setStyleSheet("background:transparent;");
area->setAttribute(Qt::WA_TranslucentBackground);
this->setCentralWidget(area);
MyChildScreenDialog *dlg = new MyChildScreenDialog ();
area->addSubWindow(dlg );
}
But unfortunatlly, setting background:transaprent and setting attribute Qt::WA_TranslucentBackground won't work in QMdiArea.
Can we make QMdiArea as transparent? What modification we need to do in above code?
Upvotes: 0
Views: 965
Reputation: 10486
Using only QSS, this is the way to go:
QMdiArea {
qproperty-background: transparent;
}
Upvotes: 1
Reputation: 361
I could able to resolve this by below code.
area->setBackground(QBrush(Qt::transparent));
Upvotes: 1