Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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,
    Megamouse


  • Lifetime Qt Champion

    Hi,

    Can you show the code of your item delegate ?


Log in to reply