title: QML Combobox with QSqlModel
body: <p>I'm currently facing problems with populating a <code>QML Combobox</code> with a <code>QSqlTableModel</code>.</p>
  
  <p><strong>Example Database:</strong></p>
  
  <pre><code>  Table Customer                    Table Project
  |   id   |   name   |      |   id   |   name  |  fk_customer  | 
  |........|..........|      |........|.........|...............|
  |    1   |  name1   |      |    1   |  pro1   |      1        |
  |    2   |  name2   |      |    2   |  pro2   |      1        |
  |    3   |  name3   |      |    3   |  pro3   |      3        |
  </code></pre>
  
  <p>I want to show a form with a <code>QML Combobox</code> to select the customer by name.<br>
  Therefore I am setting the combobox model to a <code>QSqlTableModel</code> with <code>table="customer"</code> and <code>textRole="name"</code>.</p>
  
  <p>My Problem now resides in setting the <code>Combobox.currentindex</code> to the correct value from the database and of course to read the <code>selected ID</code> back from the combobox.<br>
  The <code>Comboboxes</code> documentation states that whenever the combobox is populated with a new model, its current index is set to <code>1</code>.<br>
  I tried to set the currentindex with <code>Component.onCompleted</code> Signal from combobox and its parent but the selected index was always set to <code>1</code>.  </p>
  
  <p>So I think I might have made conceptional mistake when implementing the model or the <code>QML-file.</code>  </p>
  
  <p>Does anyone know a suggested way when and how to pre set a QML Combobox with a given value from c++ model?</p>