PDA

View Full Version : QComboBox addItems() inserts QStringList twice



jshafferman
3rd January 2012, 16:41
I have an application where I insert items into a QStringList stringList and then when filling in the QComboBox I use comboBox->addItems(stringList) to populate the drop down box.

I am populating the QStringList like so:

stringList.append("First");
stringList.append("Second");
// and so on

I populate the combo box like so:

comboBox->addItems(stringList);

When I go to click the drop down arrow, I see the following list of items in the combo box:

First
Second
First
Second

Why is the combo box being populated twice with the QStringList?

Thanks for any help!!

^NyAw^
3rd January 2012, 16:53
Hi,

Are you sure that your are not populating the QStringList twice? Or maybe adding the items twice?
You can call "QComboBox::clear()" before adding the items.