Results 1 to 3 of 3

Thread: Widget styles problem.

  1. #1
    Join Date
    Mar 2012
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Widget styles problem.

    Hello all,

    i have several style problems:

    - Is there a way to change the font-weight (or font-size minimum) of the selected item in QListWidget?
    I try this styleSheet:
    Qt Code:
    1. "QListWidget::item:selected{font-size: 20px;"
    2. "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #cdcdcd, stop: 1 #5781AE);}"
    To copy to clipboard, switch view to plain text mode 
    The background color works, but not the font size.

    - Is ther a way to change only the color of a QPorgressBar?
    I mean that when i apply a style sheet only for the backround color like this
    Qt Code:
    1. "QProgressBar::chunk {"
    2. "background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #76B900, stop: 0.5 white, stop: 1 #76B900 );}"
    To copy to clipboard, switch view to plain text mode 
    all properties of the original QProgessbar style are disabled.

    Thanks for your answer.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Widget styles problem.

    - Is there a way to change the font-weight (or font-size minimum) of the selected item in QListWidget?
    No, as such font style option applies to QWidgets, so you could apply the font (or other like font-size) style option to the entire QWidget (QListWidget in this case) and not to special behavior of a derived QWidget i.e. QListWidget's selection item.

    - Is ther a way to change only the color of a QPorgressBar?
    I mean that when i apply a style sheet only for the backround color like this
    No, Qt Style Sheets documentation clearly states this fact
    Quote Originally Posted by Qt Docs
    The QProgressBar's border, chunk, and text-align can be customized using style sheets. However, if one property or sub-control is customized, all the other properties or sub-controls must be customized as well.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Mar 2012
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Widget styles problem.

    Thanks for your answers.

Similar Threads

  1. About include 'styles'
    By tonnot in forum Newbie
    Replies: 2
    Last Post: 21st September 2010, 18:11
  2. GUI Styles
    By dsmcc in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2008, 15:58
  3. PyQt Styles
    By awestman in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 13:59
  4. Problem with Qt4 Styles
    By drake1983 in forum Newbie
    Replies: 2
    Last Post: 10th February 2008, 03:11
  5. Styles - building
    By Salazaar in forum Newbie
    Replies: 10
    Last Post: 20th May 2007, 18:19

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.