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. How can i set background of the inactive QTabWidget to transparent?
Forum Updated to NodeBB v4.3 + New Features

How can i set background of the inactive QTabWidget to transparent?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 613 Views 2 Watching
  • 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.
  • S Offline
    S Offline
    StudentScripter
    wrote on last edited by
    #1

    6262fefb-d542-4667-a6ad-96f58fd5fc7d-image.png

    Workspace should be transparent instead of white.

    I tried this but it didn't work:

    objectTab->setStyleSheet("QTabWidget::pane { background-color: transparent; }");
    workspaceTab->setStyleSheet("QTabWidget::pane { background-color: transparent; }");
    tabWidget->setStyleSheet("QTabWidget::pane { background-color: transparent; }");
    
    Chris KawaC 1 Reply Last reply
    0
    • S StudentScripter

      6262fefb-d542-4667-a6ad-96f58fd5fc7d-image.png

      Workspace should be transparent instead of white.

      I tried this but it didn't work:

      objectTab->setStyleSheet("QTabWidget::pane { background-color: transparent; }");
      workspaceTab->setStyleSheet("QTabWidget::pane { background-color: transparent; }");
      tabWidget->setStyleSheet("QTabWidget::pane { background-color: transparent; }");
      
      Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @StudentScripter QTabWidget::pane is the selector for the contents of tab widget i.e. the space beneath the tab bar. QTabWidget is a compound widget consisting of a QTabBar and a stack widget. To style the tabs you need a selector for the tab in a tab bar.

      tabWidget->setStyleSheet("QTabBar::tab:!selected { background-color: transparent; }");
      
      S 1 Reply Last reply
      1
      • Chris KawaC Chris Kawa

        @StudentScripter QTabWidget::pane is the selector for the contents of tab widget i.e. the space beneath the tab bar. QTabWidget is a compound widget consisting of a QTabBar and a stack widget. To style the tabs you need a selector for the tab in a tab bar.

        tabWidget->setStyleSheet("QTabBar::tab:!selected { background-color: transparent; }");
        
        S Offline
        S Offline
        StudentScripter
        wrote on last edited by
        #3

        @Chris-Kawa Ah thank you very much. :) With all those properties its quite easy to get confused. May another question i have the tab widgets set to be movable. They are embedded in a dockwidget. However if ich drag very far to left or right the tab before releasing it shortly disapears behind the border. Is there a way to fix this?
        60395447-701c-4e8d-a95b-dfc3b8f50b3b-image.png
        25db42d8-2811-46ca-a671-90bb9a3cc300-image.png

        Chris KawaC 1 Reply Last reply
        0
        • S StudentScripter

          @Chris-Kawa Ah thank you very much. :) With all those properties its quite easy to get confused. May another question i have the tab widgets set to be movable. They are embedded in a dockwidget. However if ich drag very far to left or right the tab before releasing it shortly disapears behind the border. Is there a way to fix this?
          60395447-701c-4e8d-a95b-dfc3b8f50b3b-image.png
          25db42d8-2811-46ca-a671-90bb9a3cc300-image.png

          Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @StudentScripter That functionality is not exposed in the API much beyond enabling/disabling, so I guess you'd have to subclass QTabBar and provide your own implementation of drag/drop of the tabs or modify Qt itself if the license you chose accommodates that.

          S 1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            @StudentScripter That functionality is not exposed in the API much beyond enabling/disabling, so I guess you'd have to subclass QTabBar and provide your own implementation of drag/drop of the tabs or modify Qt itself if the license you chose accommodates that.

            S Offline
            S Offline
            StudentScripter
            wrote on last edited by
            #5

            @Chris-Kawa Ok thank you very much, gonna have a look at that than. :)
            Have a nice day.

            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