[Qt-interest] Use qlineargradient as background of widget (stylesheet)

Oliver Demetz forenbeitraege at oliverdemetz.de
Fri Jun 5 22:21:48 CEST 2009


Hi!
My widget is a combination of a QHBoxLayout and child QBoxLayouts, 
filled with QPushbuttons, a QSlider and a QGraphicsView, so nothing 
extraordinarily special.

Simplified my code looks like

class MyWidget : public QWidget
{
     MyWidget()
     {
         QVBoxLayout * lay = new QVBoxLayout;
         //...fill it...
         this->setLayout(lay);
    }
}

If I set the stylesheet of my ap as:

MyWidget {
     background: qlineargradient(x1:0,y1:1,x2:1,y2:0, stop:0 
#2D2B2B,stop:0.1 #2D2B2B, stop:1 #BEBEBE);
}

then the lineargradient is displayed  *multiple times*!


The widget is split up in several (4) rectangular areas around the 
QGraphicsView and each of these areas has its own linear gradient as 
background!

What can be the problem? The GraphicsView?
see screenshot http://www.oliverdemetz.de/screenshot.jpg

Thanks for your help in advance,
Oliver



More information about the Qt-interest-old mailing list