Important: Please read the Qt Code of Conduct -

QStyledItemDelegate: set Font Color when State is inactive

  • I have a problem setting up foreground color for etiher normal QTableWidgets or QTableWidgets with custom QStyledItemDelegate.

    This is my stylesheet:

    QTableWidget::item:selected:active {
    	background-color: red;
    	color: black;
    QTableWidget::item:selected:!active {
    	background-color: black;
    	color: red;

    The background-color switches from red to black as expected when I focus/unfocus the Item.
    But the foreground color is never applied to the text.

    Best Regards,

  • Lifetime Qt Champion


    Can you show the code of your item delegate ?

Log in to reply