I have a QCombobox wich model is a QSqlTableModel populated with a DataBase table:
Integer | String
=-=-=-=-=-=-=-=
|
=-=-=-=-=-=-=-=
0 | Normal
=-=-=-=-=-=-=-=
1 | Leve
=-=-=-=-=-=-=-=
2 | Moderado
=-=-=-=-=-=-=-=
3 | Severo
=-=-=-=-=-=-=-=

the combobox works finecombo.PNG
but when I try to set the value in combo acording with the database table, I use this code
Qt Code:
  1. void MyComboBox::setValor(QVariant myValue)
  2. {
  3. QModelIndexList myFinded=this->model()->match(this->model()->index(0,0),Qt::DisplayRole,myValue,5,Qt::MatchFlags(Qt::MatchExactly || Qt::MatchWrap));
  4.  
  5. this->setCurrentIndex(myFinded[0].row());
  6. }
To copy to clipboard, switch view to plain text mode 
When myValue is 1, myFinded has 1 Index (corresponding to row 2)
When myValue is 2, myFinded has 1 Index (corresponding to row 3)
and so on
but when myValue is 0, myFinded has 2 Index (corresponding to row 0 and 1)
I don't understand why. Is this a bug? Or am I doing something wrong