How to change the image background of each QTabBar in my QTabWidget



  • Hi,
    I'm creating an app using QTabWidget object, and for customizing it, I'm using a CSS file.
    The problem is that I can change the background of all my Tab Bars but i can not customize each one of theme ( for example changing the background image of each one of theme ).
    This is my CSS code for customizing all the tabs:
    QTabBar::tab {
    background-repeat: no-repeat;
    background-position: center;
    width: 127px;
    border-right: 1px solid white;
    padding-top: 88px;
    padding-bottom: 18px;
    color: white;
    font-style: bold;
    }


  • Moderators

    Hi, welcome to devnet.

    With qss you can only style arbitrary tabs like :first, :last, :middle, :only-one etc. Unfortunately there's no way to style specific tab, e.g. :nth(42). To get to individual tabs you would have to do it from code.



  • @Chris-Kawa ok, Thanks man for your reply I really appreciate it :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.