[Qt-interest] Setting the background color of a tab

Jonas Gehring jonas.gehring at boolsoft.org
Thu Aug 4 02:41:36 CEST 2011


On 08/04/2011 12:13 AM, Scott Aron Bloom wrote:
> Yes, CSS updates at runtime...

True, but I'm afraid you can't explicitly set the background color of
tab i. According to the documentation at
http://doc.qt.nokia.com/latest/stylesheet-reference.html#qtabbar-widget
, you can only manipulate a few specific tabs using style sheets
(:first, :last, ...).

You can reimplement QTabBar::paintEvent() and modify the
QStyleOptionTabV3 structure, but you've got to be careful not to mess up
with desktop integration.

- Jonas


> -----Original Message-----
> From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com
> [mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On
> Behalf Of Jake Colman
> Sent: Wednesday, August 03, 2011 1:04 PM
> To: qt-interest at qt.nokia.com
> Subject: Re: [Qt-interest] Setting the background color of a tab
> 
> 
> 
> I need to set it on the fly at runtime as things change.  And I need
> different tabs to have different background colors.  Can all that be
> done via CSS?
> 
> 
>>>>>> "JF" == Jesus Fernandez <jsfdez at gmail.com> writes:
> 
>    JF> You can set with CSS the background-color of QTabWiget.
> 
>    JF> On Wed, Aug 3, 2011 at 21:52, Jake Colman <colman at ppllc.com>
> wrote:
> 
>    >> 
>    >> Is it possible to set the background color of a tab?  Given a
>    >> QTabBar one can set the text color.  But can one set the
>    >> background?
>    >> 
>    >> --
>    >> Jake Colman | Director, Software Development
>    >> Principia Partners LLC
>    >> 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770
>    >> t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929
>    >> e: colman at ppllc.com | w: www.principiapartners.com
>    >> Credit technology innovation awards winner 2008, 2009 & 2010
>    >> 
>    >> _______________________________________________
>    >> Qt-interest mailing list
>    >> Qt-interest at qt.nokia.com
>    >> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>    >> 
>    JF> _______________________________________________
>    JF> Qt-interest mailing list
>    JF> Qt-interest at qt.nokia.com
>    JF> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> 
> --
> Jake Colman | Director, Software Development Principia Partners LLC
> 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770
> t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929
> e: colman at ppllc.com | w: www.principiapartners.com Credit technology
> innovation awards winner 2008, 2009 & 2010
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110804/82db35de/attachment.bin 


More information about the Qt-interest-old mailing list