Painting1
Painting1

Reputation: 170

Customising a Qt library class

Qt's QTabBar has functionality to set the colour of text on each tab.

I'd like my application to be able to set the background colour of each tab. From what I can see, QTabBar isn't easily modifiable (e.g. by inheritance or changing a property) to do this.

This leaves me with the option of copying the QTabBar code wholesale into my (GPL) application, then modifying the class name (i.e. MyQTabBar), then adding my functionality. Is this the preferred method, or is there a better way?

Upvotes: 2

Views: 115

Answers (1)

Arnold Spence
Arnold Spence

Reputation: 22292

There is definitely a better way :) You should be able to do what you want using stylesheets. This article covers some of this with a QTabWidget which contains a QTabBar.

Upvotes: 1

Related Questions