[Qt-interest] Pseudo style setting in a local object
Girish Ramakrishnan
girish at forwardbias.in
Wed Jun 24 13:41:31 CEST 2009
Santhosh Y wrote:
> Girish Ramakrishnan wrote:
>> 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'.
>>
> No; I meant to set a tabbar style to one of the tabbars in my
> application but not to all.
Ah ok. You don't need pseudo states for that. You can either use
1. objectnames.
tabBar->setObjectName("tabbar1");
and then in your stylesheet,
QTabBar#tabbar1::tab:selected { .. }
2. dynamic properties
tabBar->setProperty("fancytab", "true");
and then in your stylesheet,
QTabBar[fancytab="true"]::tab:selected { .. }
Girish
More information about the Qt-interest-old
mailing list