PDA

View Full Version : QTabWidget



Freeman551
24th December 2009, 18:45
I've got a QTabWidget control with different tabs for chat conversations, how can I light one up to show there are new messages for that tab. I've tried SetFocus and had a good look around the API with no luck

Thanks

Lykurg
24th December 2009, 20:08
you have to subclass QTabWidget and add that functionality by your own. There is no such feature but a implementation is not that hard. Just try it.

Freeman551
24th December 2009, 21:50
Thanks for your reply, once I've made my own custom tab widget as a sub class of QTabWidget what calls do I make to make the actual tab things change colour/state?

Coises
25th December 2009, 00:06
You could assign it a distinctive icon with QTabWidget::setTabIcon.

If you want to control individual tabs with more options than QTabWidget provides, sub-class it and use QTabWidget::tabBar to get the tab bar widget; that would allow you to change the text color, for example, of individual tabs.

It looks as if the tab bar itself is one widget, with no provision for changing the background color of individual tabs; so if you want to do that, I think you would have to implement a custom QTabBar::paintEvent using QTabBar::tabRect to figure out which areas need to be painted with a different background, and use QTabWidget::setTabBar to make the tab widget use your custom tab bar.