Hello all,

I have a 2 tables. One of them have the following data:

Qt Code:
  1. ID Text
  2. ----------------
  3. 1 Apple
  4. 4 Banana
  5. 6 Mango
  6. 8 Rambutan
  7. 19 Durian
To copy to clipboard, switch view to plain text mode 

I got a QComboBox to populate with the right text using QSqlRelationalTableModel and QSqlTableModel:
Qt Code:
  1.  
  2. // etc etc... populate database, set relations as per example on help files etc...
  3.  
  4. QSqlTableModel * relModel = rtmodel->relationModel(typeIndex);
  5. ui->myComboBox->setModel(relModel);
  6. ui->myComboBox->setModelColumn(relModel->fieldIndex("Text"));
To copy to clipboard, switch view to plain text mode 

The QComboBox shows the text fine, meaning I can choose the fruit I want. How do I get the selected text's ID once I've selected the text? Say, I picked Durian, how do I get myComboBox to return the value '19'?

Thanks.