Results 1 to 2 of 2

Thread: QTabWidget + tab button color( how to set ? )

  1. #1
    Join Date
    Dec 2009
    Posts
    50
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default QTabWidget + tab button color( how to set ? )

    Hi Everybody.
    How can I change the color of tab button?
    I can change the color of tab( widget itself by setting up the pallete ) but cannot find the way to change tab button ( the button you press to change the tab ).
    Qt Code:
    1. mTabWidget = new QTabWidget;
    2. mTabWidget->setStyleSheet("QToolButton { border-width: 1px; border-style: solid; border-color: green; background-color: red;}");
    To copy to clipboard, switch view to plain text mode 

    does not work.

    Also how can I change color of the rect around tabs ?
    If I change border color of the tab widgets the overall border color still partially remains gray.


    UPD:

    problem solved ( found Customizing QTabWidget and QTabBar )
    Last edited by medved6; 10th September 2010 at 06:51.

  2. #2
    Join Date
    Jul 2010
    Location
    Ahmedabad,Gujarat,India
    Posts
    25
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Re: QTabWidget + tab button color( how to set ? )

    simply give stylesheet to tab widget no need to write code for this. change stylesheet of TabWidget as below mentioned..


    QTabBar::tab:selected {
    color: #4FA600;
    background-color: rgb(255,255,255);
    }

    QTabBar::tab:!selected {
    color: rgb(255,255,255);
    background-color: #4FA600;
    border-bottom-color: #4FA600;
    }


    QTabWidget:ane { /*replace icon text as pane ok....*/
    margin: 1px,1px,1px,1px;
    background-color: rgb(255,255,255);
    }

    QTabBar::tab {
    border: 2px solid rgb(0,149,48);
    border-bottom-color: rgb(255,255,255);
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    height: 40px;
    width: 170px;
    background-color: rgb(255,255,255);
    }

    QTabWidget{
    background-color: rgb(255,255,255);
    font: 75 14pt "Arial Rounded MT Bold";
    }

    QTabWidget::tab-bar {
    left: 5px; /* move to the right by 5px */
    bottom: -1px;
    background-color: rgb(255,255,255); }

    i m sure this will work nice....

Similar Threads

  1. How to change color of Tab in QTabWidget?
    By rajesh in forum Qt Programming
    Replies: 10
    Last Post: 21st October 2013, 07:52
  2. Qtabwidget - how to add a button to all tabs?
    By creep33 in forum Qt Programming
    Replies: 2
    Last Post: 22nd July 2010, 19:05
  3. Button on QTabWidget
    By winston2020 in forum Qt Programming
    Replies: 3
    Last Post: 24th October 2008, 07:45
  4. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 22:25
  5. Changing QTabWidget's tabs color
    By troorl_ua in forum Qt Programming
    Replies: 1
    Last Post: 14th May 2007, 21:49

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
  •  
Qt is a trademark of The Qt Company.