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->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
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
To copy to clipboard, switch view to plain text mode
Thanks for yout help
Regards,
Oscar
Bookmarks