[Interest] How to programatically make a tab's text bold?

André Pönitz apoenitz at t-online.de
Wed Apr 4 17:39:47 CEST 2018

On Wed, Apr 04, 2018 at 05:10:07AM +0000, Vadim Peretokin wrote:
> How can I programatically make a tab's text bold? I'm looking to notify the
> user that they need to look at it.
> Note that this is different from using a stylesheet to set the selected tab
> bold - I'd like to set any random tab's text bold.
> Been looking at this for several days, appreciate any advice!

Quick and dirty:

struct Style : QProxyStyle
    void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const
        if (element == QStyle::CE_TabBarTab) {
            QFont f = p->font();
        QProxyStyle::drawControl(element, opt, p, w);

    yourTabWidget()->tabBar()->>setStyle(new Style);

May need some polish.


More information about the Interest mailing list