Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Styling a QTabWidget
Qt 6.12 LTS is out! See what's new in the release blog

Styling a QTabWidget

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.9k Views 1 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.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    Hi
    I am trying to style QTabWidget so that the tabs have rounded corners and the background colour of the tab widgets is light blue.
    The stylesheet I am using is -
    @
    QTabWidget QWidget
    {
    background-color: lightblue;
    }
    QTabWidget::pane { /* The tab widget frame */
    border-top: 2px solid #C2C7CB;
    }

    QTabWidget::tab-bar {
    left: 5px; /* move to the right by 5px */
    }

    /* Style the tab using the tab sub-control. Note that
    it reads QTabBar not QTabWidget */
    QTabBar::tab {
    min-height: 24px;
    border-top: 1px solid palette(mid);
    border-left: 1px solid palette(mid);
    border-bottom: 0px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    margin-top: -1px;
    margin-right: 4px;
    padding-left: 5px;
    background: rgb(210, 221, 239);
    }

    QTabBar::tab:selected, QTabBar::tab:hover {
    border-bottom: 1px solid palette(mid);
    background: yellow;
    }

    QTabBar::tab:!selected {
    margin-top: 5px;
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(156, 181, 220), stop:1 rgb(130, 160, 210));
    }
    @
    This is almost what I need except that the area behind the tab bar is the same color as the tab widget which is undesirable.
    Is there a way of removing this?
    https://www.dropbox.com/s/eak424onhblfmxo/tabs.png
    Thanks

    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
    • Unsolved