Unsolved Default QPalette::Text is the same for QPalette.Active and QPalette::Disabled?
-
A default QListView (on macOS) paints text with a white color when enabled and grey color when disabled, which is correct. However,
listView.palette().color(QPalette.Active, QPalette.Text)
returns white just the same aslistView.palette().color(QPalette.Disabled, QPalette.Text)
.What gives? Why doesn't the second call return the grey color that is actually used?
Full example:
app = QApplication(sys.argv) w = QListWidget() w.addItem('Here') w.addItem('You') w.addItem('Are') w.show() w.activateWindow() print('w QPalette.Active', w.palette().color(QPalette.Active, QPalette.Text).name()) print('w QPalette.Disabled', w.palette().color(QPalette.Disabled, QPalette.Text).name()) print('app QPalette.Active', app.palette().color(QPalette.Active, QPalette.Text).name()) print('app QPalette.Disabled', app.palette().color(QPalette.Disabled, QPalette.Text).name()) app.exec()
outputs:
turin:pkdiagram patrick$ python test.py w QPalette.Active #ffffff w QPalette.Disabled #ffffff app QPalette.Active #ffffff app QPalette.Disabled #ffffff