[PyQt] coloring a QDialog

TP paratribulations at free.fr
Wed Apr 8 09:26:18 BST 2009

Hi everybody,

To color a QDialog (for example), I can do:

from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys
app = QApplication( sys.argv )
dialog = QDialog( )
dialog.palette().background().setColor(Qt.blue) # @

But if I replace the line "@" by:

dialog.setForegroundRole( QPalette().Dark )

it seems it does not work: the color is the same with and without this line.

What is the problem?


python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)

More information about the PyQt mailing list