Sounds like what you really need is your own item delegate and overwriting setEditorData() to do your checks.
I am not sure which delegate the QTableWidget uses by default, but it is probably a QStyledItemDelegate.
So deriving from that and reimplementing the method should come close.
Cheers,
_
Bookmarks