[Qt-interest] Pseudo style setting in a local object

Girish Ramakrishnan girish at forwardbias.in
Wed Jun 24 12:45:48 CEST 2009


Santhosh Y wrote:
> Hi,
> 
> I would like to set different style for 2- QTabBar present in my
> applicaiton. Globally I can set for all the QTabBars
> in the following manner on qApp->setStyleSheet (
> 
>    "QTabBar::tab:selected { color:black \
>                                     background-color: blue; }"
> 
>   "QTabBar::tab:!selected { color:black; \
>                                      background-color:white}"
> );
> 
> If I want to set to a single tab bar but not for the other one, how to
> set this pseudo state style set on QTabBar;
> 

I assume you meant 'single tab' and not 'single tab bar'.

> Let us say I have a QTabBar* tb1 =  new QTabBar ();
>                               tb1->setStyleSheet (..............//How
> can I set pseudo state here!);
> 

You can use, :first, :last, :middle. But you don't have pseudo states to
style based on the tab position i.e 4th tab. There is a task somewhere
to introduce css3 style pseudo state functions. i.e
QTabBar::tab:index(4) { } but I don't think it has been implemented yet.

Girish



More information about the Qt-interest-old mailing list