@MH24 said:
Should I have used a QSqlTableModel here instead? Can we use the default and subclassed one in same class?
Models are for displaying in a view. You don't need a model to get data out of a database. Use QSqlQuery instead and as a local variable. You don't need to allocate everything dynamically if you only use it locally. You can construct a SQL query that will get you those unique values while you're at it. Simpler and shorter.
So if I click 2nd button of any table all 2nd rows of all tables would be edit enabled
Then the problem is still the same - you're writing a variable in one model and read different variables in different models. Either write the variable to all the models or read from a single place that you write to.