oscar
13th August 2008, 15:37
Hi,
If I associate a QComboBox to a table with setModel, then I can only manually add one item to this combobox. If I add 2 items, only one empty item appears at the end of the list.
How can I do? (I don't want to put the missing items into the database, I want them to be added dynamically).
Here is the source code:
myModel = new QSqlRelationalTableModel();
myModel->setTable("woundType");
myModel->select();
typeCbx->setModel(myModel);
typeCbx->setModelColumn(2);
typeCbx->insertItem(2, QString(""));
typeCbx->addItem(QString("Ajout/Modification/Suppression"));
typeCbx->addItem(QString("Others")); //if I add this item, only one empty line appears at the end of the combobox
Thanks for yout help
Regards,
Oscar
If I associate a QComboBox to a table with setModel, then I can only manually add one item to this combobox. If I add 2 items, only one empty item appears at the end of the list.
How can I do? (I don't want to put the missing items into the database, I want them to be added dynamically).
Here is the source code:
myModel = new QSqlRelationalTableModel();
myModel->setTable("woundType");
myModel->select();
typeCbx->setModel(myModel);
typeCbx->setModelColumn(2);
typeCbx->insertItem(2, QString(""));
typeCbx->addItem(QString("Ajout/Modification/Suppression"));
typeCbx->addItem(QString("Others")); //if I add this item, only one empty line appears at the end of the combobox
Thanks for yout help
Regards,
Oscar