You can write a slot/function like this

Qt Code:
  1. void MyClass::tableSelected (const QString & tableName)
  2. {
  3. if (tableName != tableModel->tableName()) {
  4. tableModel->setTable (tableName);
  5. tableModel->select(); // to populate the model
  6. }
  7. }
To copy to clipboard, switch view to plain text mode