PDA

View Full Version : QToolBar gradient color



^NyAw^
28th February 2008, 16:00
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,

THRESHE
28th February 2008, 17:28
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

background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #E1E1E1, stop: 0.4 #FF92BB,
stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
for instance.
Good luck