QMdiArea tabs background color to transparent?
-
wrote on 5 Nov 2022, 09:31 last edited by Paddle 11 May 2022, 10:28
-
wrote on 5 Nov 2022, 10:29 last edited by
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 -
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.
Thankswrote on 5 Nov 2022, 10:49 last edited by@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. -
wrote on 5 Nov 2022, 13:16 last edited by Paddle 11 May 2022, 13:18
@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?
3/4