How to add options or items to QComboBox dynamically?
Unsolved
Mobile and Embedded
-
I have a Qcombobox in my ui.The number of options in the combobox should be dynamically added.
I tried ui->comboBox->additem("one");
ui->comboBox->additem("two");
its not working.Please suggest -
Hi,
QComboBox has method addItems(), store the values which u are getting from database or file in QStringList variable, then pass the variable to addItems().
Below is the sample lines of code :
QStringList stringList;
stringList // store the values in this variableQComboBox comboboxObject;
comboboxObject.addItems(stringList);Thanks,
-
@Sherlin-N-G I just tried addItem and it works just fine.
Can you show more of your code?
You're definitely doing something wrong.