I have an editable QComboBox *m_combo_name. I modify/correct the text as the user type
QString mod_name = ....
and write the modifed text back, thus:
m_combo_name->lineEdit()->setText(mod_name);
m_combo_name->lineEdit()->setText(mod_name);
To copy to clipboard, switch view to plain text mode
That works fine, but when I try to add more items, from a list, QList<QString> optional_names, thus
for (int i=0; i<optional_names->size(); i++){
m_combo_name->insertItem(i+1, optional_names.at(i));
}
for (int i=0; i<optional_names->size(); i++){
m_combo_name->insertItem(i+1, optional_names.at(i));
}
To copy to clipboard, switch view to plain text mode
the text in the combobox' LineEdit gets overwritten (I want to preserve the text in the LineEdit). I thought I could avoid that by using the index i+1, but it makes no difference. What am I doing wrong?
Another question: is it possible to open the drop-list, from code, when new items are added? In the same manner as Wikipedia.
Bookmarks