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

Jake Colman colman at ppllc.com
Thu Aug 4 04:18:02 CEST 2011


All I need (it sounds like it _should_ be simple) is, for a given tab
index, specify the background color based on certain runtime
conditions.  I have no problems subclassing specific Qt classes if
that's what's required.  Can you give me some more details as to how I
should go about doing this?

>>>>> "JG" == Jonas Gehring <jonas.gehring at boolsoft.org> writes:

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

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

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

   JG> - 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
   JG> _______________________________________________
   JG> Qt-interest mailing list
   JG> Qt-interest at qt.nokia.com
   JG> 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




More information about the Qt-interest-old mailing list