Results 1 to 3 of 3

Thread: Help on QTabBar colors

  1. #1
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Help on QTabBar colors

    I need to be able to set the colors (via use of QPalette) of the tabs in a QTabBar (or the tab bar in a QTabWidget) individually. I can't seem to find a simple way to do this, short of creating a custom QTabBar.

    Does anyone know if there is a way to do this?

    Thanks in advance,
    Susan

  2. #2
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help on QTabBar colors

    Well I figured out how to do this in case anyone is interested. The QStyle (derivations) color the tabs using QPalette::Window (& WindowText) for the current tab and QPalette::Button (& ButtonText) for the non-current (selectable) tabs.

    So, you need to derive from QTabWidget, so that you can get access to the protected tabBar() method. Then you can set the palette colors for these and applying it to the QTabBar* instance returned by ::tabBar().

    Hope this helps anyone who is customizing the colors of the tabs...

  3. #3
    Join Date
    Sep 2011
    Location
    Portugal
    Posts
    25
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Help on QTabBar colors

    Does that allow you to set a different background color for each tab?

Similar Threads

  1. QToolBox Colors
    By rooney in forum Qt Programming
    Replies: 3
    Last Post: 3rd September 2010, 14:37
  2. problems about QTabBar
    By qtopiahooo in forum Qt Programming
    Replies: 4
    Last Post: 10th October 2006, 10:05
  3. Fonts, Colors, and QStyle
    By Jimmy2775 in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2006, 07:26
  4. Qt Designer 4.0.1 Preview Colors
    By jtyler in forum Qt Tools
    Replies: 2
    Last Post: 14th February 2006, 15:47
  5. QTAbBar not displaying
    By Dune in forum Qt Programming
    Replies: 17
    Last Post: 9th February 2006, 18:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.