Important: Please read the Qt Code of Conduct -

Problem in making Fixed size QtabWidget's tab

  • Hi All,
    I will be creating many tabs with with different tab text at runtime..
    but the tab bar size is keep-on getting increased depending upon the Tab Text , which i provided at runtime..
    So i used the following function to make it fixed width.
    ui->tabWidget->setStyleSheet("QTabBar::tab{height:20px; width:160px; font: 8pt;alignment: left;}");

    now i am able to see my QTabWidget Tab size is fixed..but the Tab text alignment is center by default( i assume )..
    but i want to show my tab text as left alignment..

    eg: Input text "test sample of tab Text"

    My ouput is " sample of tab Te"

    but i want ouput should be "test sample of ta..."

    Please let me know...whether i am doing anything wrong in my operation on achiving fixed tab size??

Log in to reply