Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTabwidget's tab text alignment not working



  • i am trying to show the opened tab text in left .i wrote that in stylesheet.but it is not working.

    i am trying to show the opened tab text in left .i wrote that in stylesheet.but it is not working.

    here is the stylesheet i used.

    QTabWidget QTabBar{
    background-color: #373738;
    height: 30px;
    }
    
    QTabWidget QTabBar::tab{
    text-align: left;
    background-color: #136ba2;
    border-style: 1px rgb(67, 67, 67);
    height: 30px;
    width: 130px;
    color: #136ba2;
    padding: 0px 5px 0px 5px;
    }
    
    QTabWidget QTabBar::tab:selected{
    background-color: #5A5B5C;
    font-weight: bold;
    color: #ffffff;
    }
    QTabWidget QTabBar::tab:!selected{
    background-color:#353536;
    color:  #B4B4B4;
    }
    QTabWidget QTabBar::tab:hover{
    background-color:  #5A5B5C;
    color:  #ffffff;
    }
    

    0_1518599311018_vd.png


  • Lifetime Qt Champion

    Hi,

    AFAIK, you can't do that like that. You can maybe play with the left property but be aware that you are doing something that your users might not like. Many people will be surprised seeing their tab text moving around just because they selected a tab.



  • here is the solution from stackoverflow.
    thanks.


Log in to reply