QSS QTabBar text-align does not work
I try (font-weigth: works, but text-align: does not work):
I try, but it was also not working:
<widget class="QTabWidget" name="tabWidget">
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tab_2">
I also have not found any "property" (<property name="...">) that aligns the text.
how to use the "QSS" to align the text of the tabs (QTabBar/QTabWidget) ?
i just checked (in Qt4): tabs don't support text alignment directly.
The only possibility you can try is to set the text-alignment on the QTabBar instead of it's ::tab selectors.
I try, but not working.
what do I do? Thanks.
it was an idea. If this isn't working either i am afraid it isn't possible at all.
Nevertheless you can do the painting yourself as a last resort.
See QTabBar::paintEvent() for more details.
And idea to do so would be to pass an style option object without the text and let the tabs be drawn by Qt. Then find out the "content rects" for each tab and draw your aligned text in there.
But if its the first time you are doing this it will be a hard work i guess.
Seems like a great idea, I'll try, even though I have not done this before I will not be so complex.
But what is odd is to have a selector (QSS) to do that.
[quote author="Guilherme Nascimento" date="1386951146"]
But what is odd is to have a selector (QSS) to do that.[/quote]
For that simply define a (styleable) property which you then use in your painting code.