Opened 15 years ago
Last modified 14 years ago
#5876 closed defect
AutoCompletingComboBox gets initialized with wrong value if data layer has both "key" and "key:subkey" elements — at Initial Version
Reported by: | ax | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
how to reproduce:
in a data layer that has has both "key" and "key:subkey" elements, eg. elements tagged with "source=bing" as well as elements tagged with "source:population=psgc", if you try editing "source=bing" in the properties panel by double-clicking or pressing "edit", the key will be initialized with the wrong value "source:population=psgc". even if you only change the value and don't touch the key, the key will be changed nevertheless because it is wrongly initialized!
cause:
AutoCompletingComboBox::insertString(..., "source", ...) calls AutoCompletingComboBox::lookupItem("source"). This method loops through all existing keys in the current layer and returns a key that '''starts with''' "source". as "source" is before "source:population" in the list being iterated over, bestItem is first set to the correct value "source", but in the next iteration overwritten with the wrong value "source:population". this wrong key is then inserted into the combobox.
solution:
i'm not familiar with the autocomplete code. on a first glance, i don't understand why AutoCompletingComboBox::insertString() needs a fuzzy startsWith to insert a discret item. but there might be a reason behind this. which is why i leave the fix to this issue to someone who knows :)