I am using PySide 1.2.1 with Python 2.7 and I need a widget to draw a colored background. In Qt Designer I created a simple window consisting of a label, a widget containing
Set the WA_StyledBackground attribute on the container widget:
ui = MainWindow()
ui.setupUi(mainwindow)
ui.widget.setAttribute(QtCore.Qt.WA_StyledBackground, True)
(PS: for performance reasons, this attribute isn't set by default for some widget classes - but the documentation doesn't seem to specifiy which ones).