If you run this code in the Python Source Editor on H16.5 and H17 you get two different results. In H16.5 the style sheet is applied properly but in H17 the background stays unchanged in the non working examples. I looked at PySide2.__version__ and PySide2.QtCore.__version__ for both Houdini versions and they are the same.
I also had a look at QPalette but I didn't see any difference between the two versions that could explain the problem.
I'd like to understand how to fix this but if this turns out to be a bug, any workaround like I've found for the QLineEdit is welcome.
Sorry, I had formatting issue that I fixed by specifying to the forum it's Python code.
#######################################################
from PySide2 import QtCore from PySide2 import QtWidgets from PySide2 import QtGui import hou class TestDialog(QtWidgets.QDialog): def __init__(self): QtWidgets.QDialog.__init__(self, None) vbox = QtWidgets.QVBoxLayout() # unchanged input field # Notice how this one has the standard white in H16 but is somehow # inheriting a black color in H17 field = QtWidgets.QLineEdit() vbox.addWidget(field) # working input field # We have to specify a border to force the color to apply working_field = QtWidgets.QLineEdit() working_field.setStyleSheet('* {background-color: red; border: 0px;}'); vbox.addWidget(working_field) # non working input field non_working_field = QtWidgets.QLineEdit() non_working_field.setStyleSheet('* {background-color: red;}'); vbox.addWidget(non_working_field) # working combo # Works when it's not an editable combo box working_combo = QtWidgets.QComboBox() working_combo.insertItems(0, ['aaaa', 'bbbb', 'cccc']) working_combo.setStyleSheet('* {background: green; border: 0px;}') vbox.addWidget(working_combo) # non working combo non_working_combo = QtWidgets.QComboBox() non_working_combo.setEditable(True) non_working_combo.insertItems(0, ['aaaa', 'bbbb', 'cccc']) non_working_combo.setStyleSheet('* {background: green; border: 0px;}') vbox.addWidget(non_working_combo) # non working check box non_working_checkbox = QtWidgets.QCheckBox() non_working_checkbox.setStyleSheet('* {background: green; }') vbox.addWidget(non_working_checkbox) # Uncomment the next code line to inherit the Houdini style sheet. # However the issue is still there #self.setParent(hou.qt.mainWindow(), QtCore.Qt.Window) self.setLayout(vbox) dialog = TestDialog() dialog.show()
Thanks
Francois