Results 1 to 2 of 2

Thread: QProgressBar stylesheet in visal studio

  1. #1
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressBar stylesheet in visal studio

    Hi,

    I'm trying to set a custom stylesheet (exactly this) for a QProgressBar via Visual Studio.

    I used that piece of CSS Code to set the stylesheet, but QProgressBar doesn't have a "setStyleSheet" method, so I don't know what to do with it. How does configure a style for it "by hand" (not using QDesigner)?


    Added after 20 minutes:


    Isolved it.

    Visual Studio was going crazy and did not recognize setStyleSheet as a valid method. Now it works fine.
    Last edited by alitoh; 24th August 2011 at 23:54.

  2. #2
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressBar stylesheet in visal studio

    Use QApplication::setStyleSheet()

    Qt Code:
    1. qApp->setStyleSheet("QProgressBar:horizontal {"
    2. "border: 1px solid gray;"
    3. "border-radius: 3px;"
    4. "background: white;"
    5. "padding: 1px;"
    6. "}"
    7. "QProgressBar::chunk:horizontal {"
    8. "background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop: 1 white);"
    9. "}"
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Using QProgressBar
    By gutiory in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2010, 06:59
  2. QProgressBar, stylesheet, and the busy indicator
    By latency in forum Qt Programming
    Replies: 0
    Last Post: 3rd September 2009, 01:10
  3. QProgressBar + Mac OS X
    By THRESHE in forum Qt Programming
    Replies: 5
    Last Post: 14th December 2007, 13:41
  4. setOrientation QProgressBar
    By fellobo in forum Qt Tools
    Replies: 4
    Last Post: 15th February 2006, 23:32
  5. QProgressBar & 200%
    By Dmitry in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2006, 11:33

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.