I have a tree, populated from an SQL database with
Qt Code:
  1. model = new QSqlQueryModel(this);
  2. model->setQuery("SELECT * FROM people ORDER BY Name");
  3. model->setHeaderData(0, Qt::Horizontal, tr("ID"));
  4. model->setHeaderData(1, Qt::Horizontal, tr("Name"));
  5.  
  6. TreeView->setModel(model);
  7. TreeView->show();
To copy to clipboard, switch view to plain text mode 

The 'ID' is the primary key of the 'people' table in the database.

My question is how do I show the tree with a given 'ID' / record already selected?

eg after a new record has been inserted into the table and its 'ID' retreived with something like
Qt Code:
  1. query.lastInsertId().toString();
To copy to clipboard, switch view to plain text mode