Solved 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; }
-
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. -
@saber said in QTabwidget's tab text alignment not working:
text-align: left;
One workaround I found is add some extra space at the end of the title;
QString tabTitle = "Page 1 ";