Results 1 to 2 of 2

Thread: QToolBar gradient color

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QToolBar gradient color

    Hi,

    I have a QMainWindow that have a QToolBar. I want this toolbar to be painted with a gradient. Have I to create a derivate class and redefine the paintEvent or is there a easy way? I want to do the same with the central widget and some docks.

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QToolBar gradient color

    Quote Originally Posted by ^NyAw^ View Post
    Hi,

    I have a QMainWindow that have a QToolBar. I want this toolbar to be painted with a gradient. Have I to create a derivate class and redefine the paintEvent or is there a easy way? I want to do the same with the central widget and some docks.

    Thanks,
    You can use style sheets for this with
    Qt Code:
    1. background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
    2. stop: 0 #E1E1E1, stop: 0.4 #FF92BB,
    3. stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
    To copy to clipboard, switch view to plain text mode 
    for instance.
    Good luck
    C++ & AMD forever

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

    ^NyAw^ (28th February 2008)

Similar Threads

  1. Using a QFrame as a color selection indicator
    By KShots in forum Qt Tools
    Replies: 8
    Last Post: 14th June 2011, 23:55

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.