I have a QPushButton in a QDockWidget, and am setting the color of the push button using a simple stylesheet ("background-color:green").

This works fine except that, when the QDockWidget containing the push button is undocked, the pushbutton reverts to its default color.

I could subclass the QDockWidget, catch the topLevelChanged() signal, and change the push button's color to what it should be, but it seems like that shouldn't be necessary...

Any ideas?

Thanks,
Martin