PDA

View Full Version : Customize QTabBar or QTabWidget



gtthang
10th February 2006, 04:14
Dear everybody out there,

I have developed my program based on QT 4.0.0 and have a requirement to set different color for each tab page title (or text in QT language). Does anyone have experience with QTabBar and QTabWidget ? If someone knows (as I hope) please do me a favour.

Greatly appreciated all your helps. Thanks in advance

Have a nice day

Ps: it's nice of you to give me some sample code snippet.

Bojan
10th February 2006, 04:25
QTabBar has a method setTabTextColor (http://doc.trolltech.com/4.1/qtabbar.html#setTabTextColor)

With QTabWidget, I think you would have to inherit a QTabWidget, and that way you would have access to the protected method QTabBar * tabBar () const. And then you can use the above function to change the text color for each tab.

Bojan

gtthang
10th February 2006, 05:07
Thank you Bojan

Your answer is good, but unfortunately the Qt version 4.0.0 I am using doesn't have any method which is so-called setTabTextColor even with QTabBar class. Thanks anyway

Regards

ps: If you find some way with Qt version 4.0.0 pls reply to me.

gtthang
15th February 2006, 09:39
Hi everybody

Could any body set the color for each tab in different color for QTabWidget object in Qt 4.0.0.

Thanks in advance