Results 1 to 14 of 14

Thread: QTabBar stylesheet references (changing base color)

  1. #1
    Join Date
    Mar 2011
    Posts
    8

    Question QTabBar stylesheet references (changing base color)

    Hello,

    first time i post here, nice to meet you everyone.

    I am working on a MDI, and I use a QTabBar to switch between documents.

    I want to change the style of the tabbar, and I use stylesheets for that.
    Customisation of the tabs is not a problem, but I can't find the subcontrol or the property to change the color of the bar at the bottom of the tabbar widget.

    What I currently have :
    QTabBar base color.jpg

    What I want to do :
    QTabBar base color wanted.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar stylesheet references (changing base color)

    hmm.. I'd try QTabWidget ::pane :top or something along these lines.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    Quote Originally Posted by high_flyer View Post
    hmm.. I'd try QTabWidget :ane :top or something along these lines.
    I did try many things like that w/o success ... but it's like an errand, i don't find many infos on the subject.

    Isn't there an exhaustive list of sub-controls and parameters for all QT classes ?

    (At least for QTabBar atm )

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar stylesheet references (changing base color)

    Isn't there an exhaustive list of sub-controls and parameters for all QT classes ?
    Sure there is:
    http://doc.qt.nokia.com/latest/style...reference.html

    But I still find it not always quite clear what is what, so I just try.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    Quote Originally Posted by high_flyer View Post
    Sure there is:
    http://doc.qt.nokia.com/latest/style...reference.html

    But I still find it not always quite clear what is what, so I just try.
    Yeah I know this link, but it is not exhaustive, I am not sure there is all the subcontrols for each class. It seems that it shows the most ofently used ones.
    I am trying to find the properties that interest me in the QTDesigner, I'll put here what i find. (I must yet find how to add a QTabBar in QTDesigner, I only see Tab Widget lol).

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar stylesheet references (changing base color)

    ut it is not exhaustive, I am not sure there is all the subcontrols for each class.
    AFAIK this is the best you can get, and it does list everything - after all, this is the official Qt Style sheet reference.
    If there are things not documented, its because they are not supposed to be used.

    But post if you find the answer to your question, so others may be helped by it.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    Quote Originally Posted by high_flyer View Post
    AFAIK this is the best you can get
    I am affraid it is ...

    I'll post what i find here, but I can't insert a QTabBar in the designer ... thx for the help anyway

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar stylesheet references (changing base color)

    but I can't insert a QTabBar in the designer
    but you can A QTabWidget which has a QTabBar.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  9. #9
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    yes, but with a QTabWidget I can't find the parameters of the QTabBar.

  10. #10
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar stylesheet references (changing base color)

    Not sure what you mean - but you can set a stylesheet, and reference in it QTabBar and all its sub components and see the changes on the fly.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  11. #11
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    Ok ... sorry for the trouble, a colleague did a "drawrect" kinda hided in the code, and I had to deactivate all the widget one by one to find what it was ...

  12. #12
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTabBar stylesheet references (changing base color)

    Can you show the stylesheet for styling the line you wanted?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  13. #13
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    It was a dumb rect. I'm deactivating it.
    I think the best solution is to play with the bottom margin or border of my QDockWidget.

    I'll post the stylesheet when i'm done.

  14. #14
    Join Date
    Mar 2011
    Posts
    8

    Default Re: QTabBar stylesheet references (changing base color)

    Ok, I couldn't solve this with stylesheet.

    In fact there is a gap in the QMainWindow between the Docks Widgets and the Central Widgets, I couldn't manage to reduce it, so I did it drawing a rec behing the widgets ... sounds crap to me, but I hope I will find a better solution later.

Similar Threads

  1. QTabBar and different background color
    By smrtak in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2012, 16:49
  2. Replies: 2
    Last Post: 8th February 2011, 14:53
  3. Changing Slider Base
    By eLancaster in forum Newbie
    Replies: 1
    Last Post: 5th December 2010, 16:28
  4. QTabBar tab color
    By Oleg in forum Qt Programming
    Replies: 3
    Last Post: 29th March 2010, 09:11
  5. QTabBar stylesheet problem
    By shud in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2009, 12:54

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.