[PyQt] qdialog and QLinearGradient shows dark gray

Joel B. Mohler joel at kiwistrawberry.us
Tue May 17 23:47:09 BST 2011

I'm having a QLinearGradient that doesn't work correctly on ubuntu with Qt 
4.6.2 and PyQt 4.7.2.  I believe these are the standard ubuntu 10.04 versions.

I'm new to Qt css, but this is working on windows so I believe my css is 
valid.  If I add this line, I get nothing but a dark background which is not 
quite black.

   self.setStyleSheet( "QDialog {background-color: QLinearGradient(x1: 0, y1: 
0, x2: 0, y2: 1, stop: 0 #f6f7fa, stop: 1 #dadbde);}")

If I replace the above line with 

   self.setStyleSheet( "QDialog {background-color: GREEN}")

I get a charming (??!! not) bright green background as I'd expect.  The same 
applies to message boxes with this dialog as parent due to the inheritance of 
style sheets (which is correct).

Is this a bug in my specific versions?  What else can I try to figure out how 
to fix the problem?


More information about the PyQt mailing list