Results 1 to 4 of 4

Thread: problem in QProgressBar setStyleSheet

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default problem in QProgressBar setStyleSheet

    hi friends,

    in dialog.cpp
    Qt Code:
    1. progressbar = new QProgressBar();
    2. label1 = new QLabel("please wait ...");
    3. progressbar->setTextVisible(false);
    4.  
    5. //for progressbar
    6. setStyleSheet("QProgressBar {border: 1px solid grey; border-radius: 8px;padding: 1px }");
    7.  
    8. //for chunk
    9. setStyleSheet("QProgressBar::chunk {background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 red, stop: 1 white); }");
    To copy to clipboard, switch view to plain text mode 

    but here only one stylesheet is working at a time ... it QProgressBar::chunk stylesheet only works in my code .. if i commented the QProgressBar::chunk stylesheet ,, QProgressBar style sheet is working ... how can i modify both at a time ...?
    please help ..

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem in QProgressBar setStyleSheet

    it happens because you override the first style sheet.
    join these styles in one string and then set this string.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. The following user says thank you to spirit for this useful post:

    wagmare (27th April 2009)

  4. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem in QProgressBar setStyleSheet

    Quote Originally Posted by spirit View Post
    it happens because you override the first style sheet.
    join these styles in one string and then set this string.
    thanks for reply .. yes its overriding the first style sheet and now i try like this
    Qt Code:
    1. setStyleSheet(" QProgressBar {border: 1px solid grey;
    2. border-radius:8px;padding:1px},
    3. QProgressBar::chunk {background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 red, stop: 1 white);
    4. width: 10px;margin: 0.5px}");
    To copy to clipboard, switch view to plain text mode 

    and its not working ... what i should use to separate the two stylsheets ... .

  5. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem in QProgressBar setStyleSheet

    sorry to post again .. remove the comma "," between the two style sheets ... its working

Similar Threads

  1. Problem in QProgressBar update
    By nikhilqt in forum Qt Programming
    Replies: 0
    Last Post: 10th March 2009, 10:20
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  4. Problem to setstylesheet
    By phillip_Qt in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2008, 06:57
  5. QSpinBox and setStylesheet problem
    By Ace-X in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2007, 11:21

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.