How to apply CSS to QHeaderView section based on some condition

In the qTableWidget header, I’ve setup a QMenu, which pops up on right click and offers unique elements from the column, to filter the data. I want to give it a different style if any column is filtered

Before when no CSS was applied to my application, I was applying style like this, and it was working fine…

brush = QtGui.QBrush(QtGui.QColor(55, 182, 144))
self.table_widget.horizontalHeaderItem(3).setBackground(brush)

But after applying CSS to the whole application, above code has no effect. I tried to set property on the header section, so that I can later style it through CSS based on dynamic property like this

self.table_widget.horizontalHeaderItem(3).setProperty('filtered', True)

But, since QTableWidgetItem is not derived from QObject, I can’t set dynamic property to it!? Can anybody help me?