Qt style sheets support sub-controls and pseudo states, you can use it to improve your customization. see Qt6 docs
In this case you can use the ::item
sub-control and the :focus
pseudo state (the “current” pseudo state doesn’t exist, but the :focus
does the same).
This is an example that you can use:
QTableView::item:focus
{
selection-background-color: yellow;
}