Results 1 to 9 of 9

Thread: Style sheets and font weight bug

  1. #1
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Question Style sheets and font weight bug

    Hi, all.

    I have a strange bug with QTabWidget styling it with custom sheet. So, I have the following code:
    QTabBar::tab {
    font-weight: bold;
    padding: 0px 10px 0 10px;
    }

    And the font is really bold, but the place for the text doesn't increase, so first and last letters are invisible.

    Any suggestions, what have I missed? Thanks in advance.
    Oleg Shparber

  2. #2
    Join Date
    Oct 2008
    Posts
    71
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Style sheets and font weight bug

    Im not much into stylesheets, but is it possible to change the width of the tab using the stylesheet? Something like
    min-width: 100;

    Although it sounds like a bug

  3. #3
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Style sheets and font weight bug

    Yeah, min-width works, but only if text width is less than its value. It doesn't fit my case.
    Oleg Shparber

  4. #4
    Join Date
    Oct 2009
    Posts
    6
    Thanked 2 Times in 2 Posts

    Default Re: Style sheets and font weight bug

    no it isn't bug
    it is right you write, left righ pads are 0
    Qt Code:
    1. QTabBar::tab {
    2. font-weight: bold;
    3. padding: 0px 10px 0 10px;
    4. }
    To copy to clipboard, switch view to plain text mode 
    try without padding

  5. #5
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Style sheets and font weight bug

    I tried it beforehand with no success I think it should recalculate widget size depending on font style changing, but it doesn't.
    Oleg Shparber

  6. #6
    Join Date
    Oct 2009
    Posts
    6
    Thanked 2 Times in 2 Posts

    Default Re: Style sheets and font weight bug

    see attachment

    tested direct in designer
    ---------------------------
    wxp, qt450, VS2008
    Attached Images Attached Images

  7. #7
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Style sheets and font weight bug

    So, here's my screenshots, both with no padding.
    Normal font:

    Bold font:

    Qt Code:
    1. QTabWidget::pane {
    2. background-color: #ffffff;
    3. border: 2px solid #56aa04;
    4. border-radius: 10px;
    5. top: -1px;
    6. }
    7.  
    8. QTabWidget::tab-bar {
    9. left: 15px;
    10. }
    11.  
    12. QTabBar::tab {
    13. border: none;
    14. color: #56aa04;
    15. height: 25px;
    16. font-weight: bold;
    17. }
    18.  
    19. QTabBar::tab:selected {
    20. background-color: #ffffff;
    21. border: 2px solid #56aa04;
    22. border-top-left-radius: 10px;
    23. border-top-right-radius: 10px;
    24. border-bottom: 3px solid #ffffff;
    25. }
    To copy to clipboard, switch view to plain text mode 
    Oleg Shparber

  8. #8
    Join Date
    Oct 2009
    Posts
    6
    Thanked 2 Times in 2 Posts

    Default Re: Style sheets and font weight bug

    I tried this on
    Qt Code:
    1. QTabWidget::pane {
    2. border: 2px solid green;
    3. border-radius: 5px;
    4.  
    5. }
    6. QTabBar::tab
    7. {
    8. border-top-left-radius:5px;
    9. font: bold 8pt "MS Shell Dlg 2";
    10. border-top-right-radius:5px;
    11. border-top:2px solid green;
    12. border-left:2px solid green;
    13. border-right:2px solid green;
    14. }
    15. QTabBar::tab:selected
    16. {
    17. color: red;
    18. }
    To copy to clipboard, switch view to plain text mode 


    it is working properly only when is in designer tabWidget->font->bold checked or programaticaly tabWidget->font()->setBold(true) called

    combination of border and font-weight make this error/bug
    Attached Images Attached Images

  9. The following user says thank you to tdt for this useful post:

    Oleg (14th February 2010)

  10. #9
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Style sheets and font weight bug

    Thanks it makes the deal. I think this issue can be reported as bug on Qt's bugtracker...
    Oleg Shparber

Similar Threads

  1. Use Style Sheets for own QWidget
    By Lodorot in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2009, 13:16
  2. style sheets
    By alisami in forum Qt Programming
    Replies: 8
    Last Post: 7th May 2009, 09:41
  3. CSS Style Sheets - Further Development?
    By bjoernbg in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 15:59
  4. Qt style sheets
    By locus in forum Qt Programming
    Replies: 5
    Last Post: 5th April 2007, 17:03
  5. style sheets
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2007, 15:14

Tags for this Thread

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.