[Development] Styling tabs of the QMdiArea

Olivier Goffart olivier at woboq.com
Thu Nov 13 15:13:12 CET 2014


On Thursday 13 November 2014 11:51:54 Marijke Van Bergen wrote:
> Hi,
> 
> I am trying to style the tabs of a tabbed QMdiArea, using qss.
> Coloring the tab and setting a border works very smoothly. But if I want to
> change the font size of the text in the tab, the tab width is not
> calculated correctly.
> The tab width is too small which makes that part of
> the text is not shown. 
> This is what I added to my qss:
> QMdiArea > QTabBar::tab:selected,
> QMdiArea > QTabBar::tab:!selected {
>       font-size: 14px;
> }
> 
> Does somebody has an idea what goes wrong here?
> Are there some qss specialists reading this mailing list?

It has been a while since I last did anything with qss. If I recall correctly, 
the QStyleSheetStyle do not use the sub selector to adapt compute the with.

Which means you should remove the :selected and do something like:
QMdiArea > QTabBar::tab { font-size: 14px; }


-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org



More information about the Development mailing list