If I change one of the to a QWidget (or QFrame) it doesn't work. Maybe
we are (or I am) missing a fundamental aspect to this 'role' concept.<br>
<br>
self.w2 = QFrame(self)<br>
self.w2.setFixedSize(100, 200)<br>
self.w2.setFrameStyle(QFrame.WinPanel)<br>
<br>
<br><br><div><span class="gmail_quote">On 2/8/06, <b class="gmail_sendername">V. Armando Sole</b> <<a href="mailto:sole@esrf.fr">sole@esrf.fr</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
At 08:26 08/02/2006 -0900, Patrick Stinson wrote:<br>>Yeah, I"m getting the same problem. If you set the role color for the<br>>child widget, and set the role color for the parent widget, the child<br>>widget just gets the color for the parent widget. This means that you
<br>>can't give child widgets their own color. For example, the following code<br>>shows no red<br><br>Funny this example works as expected:<br><br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br><br>class AllGreen(QWidget):
<br> def __init__(self):<br> QWidget.__init__(self)<br> layout = QVBoxLayout(self)<br><br> self.w1 = QLineEdit(self)<br> self.w2 = QLineEdit(self)<br> self.w3 = QLineEdit(self)<br>
<br> palette = self.palette()<br> role = self.backgroundRole()<br> palette.setColor(role, QColor('green'))<br> self.setPalette(palette)<br><br> palette1 = self.w1.palette()<br> role =
self.w1.backgroundRole()<br> palette1.setColor(role, QColor('red'))<br> self.w1.setPalette(palette1)<br><br> palette2 = self.w2.palette()<br> role = self.w2.backgroundRole()<br> palette2.setColor
(role, QColor('yellow'))<br> self.w2.setPalette(palette2)<br><br> palette3 = self.w3.palette()<br> role = self.w3.backgroundRole()<br> palette3.setColor(role, QColor('red'))<br> self.w3.setPalette
(palette3)<br> layout.addWidget(self.w1)<br> layout.addWidget(self.w2)<br> layout.addWidget(self.w3)<br><br>def testWidget():<br> import sys<br> a = QApplication(sys.argv)<br> QObject.connect
(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))<br><br> w = AllGreen()<br> w.show()<br> a.exec_()<br><br>if __name__ == "__main__":<br> testWidget()<br><br>************************************************************
<br>V. A. Solé<br>ESRF - BLISS Group PHONE: +33 (0)4 76 88 25 84<br>BP
220
FAX: +33 (0)4 76 88 25 42<br>38043 - Grenoble Cedex<br>France<br>************************************************************<br><br></blockquote></div><br><br clear="all"><br>-- <br>Patrick Kidd Stinson<br><a href="http://pkaudio.sourceforge.net/">
http://pkaudio.sourceforge.net/</a><br><a href="http://pksampler.sourceforge.net/">http://pksampler.sourceforge.net/</a>