Observe the following code
#!/usr/bin/env python3
from PyQt5 import QtWidgets as w
class MyWidget(w.QWidget): pass
app = w.QApplication([])
frame = w.QWidget()
grid = w.QGridLayout()
frame.setLayout(grid)
w1 = MyWidget()
w2 = w.QWidget()
grid.addWidget(w1)
grid.addWidget(w2)
w1.setStyleSheet("background-color: red")
w2.setStyleSheet("background-color: red")
frame.show()
app.exec_()
The resulting app doesn't produce two identical red widgets. Qt documentation implies that things like stylesheets should work just perfectly with subclassed widgets. What's wrong here?