Hi
I have a style sheet for QTabWidget and QTabBar that looks ok except that I 
cannot figure out how to make the tab width dependant on the text that it is 
displaying. Currently I have this as a fixed value but when I add a new tab 
with a wider label I have to adjust the style sheet.
Is there a way of doing this dynamically?

here is my style sheet

    QTabWidget, QStackedWidget
    {
     background: none
    }
    QTabWidget QWidget
    {
     background-color: lightblue;
    }
     
    QTabWidget::pane
    {
     border: 0px;
     top: 0.1em;
     border-image: url(tabBG.png);
         border-width: 1px;
         border-style: solid;
         border-color: grey;
    }
    QTabBar::tab
    {
     width: 120px;
         margin-left: 0.5;
     
        margin-right: 0.5;
     
         border: 1px solid #7a7a7a;
     
         border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        padding: 2px 6px 2px 6px;
    }
     
     
    QTabBar::tab:!selected {
        margin-top: 2px;
    }
    QTabBar::tab:selected {
        margin-top: -1px;
         background-color: lightblue;
      borderwidth: 0px;
    }
     
    QTabBar::tab::bottom
    {
         border-bottom-left-radius: 4px;
        border-bottom-right-radius: 4px;
         border-top-left-radius: 0px;
        border-top-right-radius: 0px;
        padding: 2px 6px 2px 6px;
    }

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to