QTabWidget sets the title font of only one tab

I created a chat program with an interface using QTabWidget. If there is an update on the tab, I want to set the tab header font to bold. With QTabWidget :: font, I can only set the font of the headers of all .

+5
source share
3 answers

Unfortunately, you can only access the text itself. The font of the text does not appear in QTabBar QTabWidget . Perhaps changing the color of the tab would be enough? Otherwise, you will have to redefine the drawing algorithms, which is likely to be cumbersome. In Qt 3, one could access QTabc tabAt(int index), but unfortunately they removed it.

+5
source

You can use the QTabBar :: setTabTextColor () method, for example:

QTabBar* bar=tagWidget->tabBar();
bar->setTabTextColor(index, Qt::blue);
+3
source

Qt, , . - :

yourTabWidget.currentWidget()->setFont(/*bold font*/);
0

All Articles