QMdiArea tabs background color to transparent?
-
Can we set the background color of the QMdiArea tab area to transparent? Such that the main area is viewed underneath?
In my example below the tabs are on QTabWidget::South. So the document, ie main area, is on top. I want to see the main area by transparancy.
See mockup below.Thanks !
-
Here's a picture of the full app to make things more clear :
I don't want a transparent background to the empty mainwindow. I want a transparent background to the MdiArea where we have our 3D view.
I tried
tab->setStyleSheet(QString::fromLatin1("QTabBar { background-color: transparent; }")); tab->setDocumentMode(true);
But this changes nothing. I suspect that it's making a transparent background to the outside.
Thanks -
@Paddle
Then don't setQTabBar
's style, what you have is doing what you asked it to (change the tab bar). Have a look at https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar, I think you want to affectQTabBar::tab
.Having said that, I have never used
QMdiArea::TabbedView
so I don't know what that creates. -
@JonB I think that setting style to the tab actually works. Because doing :
tab->setStyleSheet(QString::fromLatin1("QTabBar { background-color: red; }"));
Works as expected. The background becomes red.
So I think the tab bar background do become transparent with the code I mentioned above. The issue is that the 3DView (ie the mdi content) is not drawn underneath the tab bar, it's drawn next to. So the transparancy only shows the empty 'mainwindow' behind.
So I think what I need is to have the QTabBar drawn ON TOP of the Mdi area. See the following drawing to explain, on the left the default behaviour, on the right what I want :
Do you know how I could get the tab bar of the MDI to be drawn on top of the Mdi content?