Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMdiArea tabs background color to transparent?
Forum Updated to NodeBB v4.3 + New Features

QMdiArea tabs background color to transparent?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 575 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paddle
    wrote on last edited by Paddle
    #1

    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 !

    310f8c87-be83-47fd-b4f0-c711599d5acd-image.png

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Paddle
      wrote on last edited by
      #2

      Here's a picture of the full app to make things more clear :
      fefbf5e0-e0c7-4e0f-9437-fa941d6ab324-image.png

      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

      JonBJ 1 Reply Last reply
      0
      • P Paddle

        Here's a picture of the full app to make things more clear :
        fefbf5e0-e0c7-4e0f-9437-fa941d6ab324-image.png

        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

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Paddle
        Then don't set QTabBar'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 affect QTabBar::tab.

        Having said that, I have never used QMdiArea::TabbedView so I don't know what that creates.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Paddle
          wrote on last edited by Paddle
          #4

          @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 :
          b337699d-572e-45de-82f5-48adca11dcc8-image.png

          Do you know how I could get the tab bar of the MDI to be drawn on top of the Mdi content?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved