Wednesday 15 June 2011

qt - QComboBox keeps storing duplicate entries -


QComboBox stores duplicate strings entered by the user, even if I have its member function Call QComboBox :: setDuplicatesEnabled (false) .

How can I handle a single copy of the string even when the user is inserted in a duplicate?

From:

Duplicate enabled: bool
This property holds that the user can enter duplicate items in the encrypted box.
Note that it is always possible to include duplicate items in the combobox according to programming.
By default, this property is false (duplicate not allowed). Login function:
> bool duplicatesEnabled () const
Zero set as Duplicate enabled (booleed) document:

P> This property holds that the user can enter duplicate items in the compartment. Note that it is always possible to programmatically insert duplicate items into the compackbox.

Therefore this option does not affect the program's defined string, you must remove the duplicate manually from your list. For example, if you're storing your list in QStringList , then the duplicate can be easily removed using the list = list. ToSet (). ToList () .

No comments:

Post a Comment