TableWidget defocus problem
When clicking on a TableWidget cell or heading, one or more cells get highlighted. After (or pehaps before) I process the event I'd like to programatically turn off that highlighting without having to click elsewhere. I haven't spotted a way to do that yet but I'm new to Qt.
But if you really don't want items to be selected a better way would be to not make them selectable in the first place. When adding QTableWidgetItems call setFlags() on them and don't set the
You can also setSelectionMode() to
Thank you for a comprehensive answer - so simple when you know how! clearSelection() solved the problem sufficiently but your answer enabled me to read through QAbstarctItemView without tears and I was able to investigate the various flags etc. The more I play with Qt the more I love it.