Results 1 to 2 of 2

Thread: Style Sheet with Gradient Background

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Style Sheet with Gradient Background

    Can someone give me a simple example of using a gradient on a background color with a style sheet? Or what has worked for you. Can't seem to find any good doc and what I tried was not good. It messed everything else up.

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Style Sheet with Gradient Background

    Hi Waynew,
    Try this:
    Qt Code:
    1. QLabel label("Now is the time for all good men to come to the aid of their party");
    2. label.setStyleSheet("* {color: qlineargradient(spread:pad, x1:0 y1:0, x2:1 y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));"
    3. "background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);}");
    4. label.show();
    To copy to clipboard, switch view to plain text mode 

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

    waynew (27th July 2010)

Similar Threads

  1. Style Sheet Syntax background
    By Tondog in forum Qt Programming
    Replies: 5
    Last Post: 28th April 2010, 07:21
  2. background gradient with stylesheets
    By martinn in forum Qt Programming
    Replies: 6
    Last Post: 28th February 2010, 15:37
  3. Add Gradient to Background for QListView
    By vasant in forum Qt Programming
    Replies: 11
    Last Post: 19th February 2010, 07:08
  4. Problems with Gradient style used through Style sheet on ARM platform
    By puneet.narsapur in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th January 2010, 12:48
  5. gradient background
    By drkbkr in forum Qt Programming
    Replies: 4
    Last Post: 30th March 2006, 16:10

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.