BUG: Fix issue with qMRMLNodeComboBox when removing an attribute filter
Created by: vovythevov
Because of the use of the [] operator on the QHash
map used to check
attributes in the qMRMLComboBox
, removing an attribute filter could lead
the combobox to never show anything.
The bug was as follow in pseudo-code:
combobox = slicer.qMRMLComboBox()
combobox.removeAttribute('vtkMRMLVolumeNode', 'MyAttribute')
-> Because of the [] operator, the map now has an entry for
vtkMRMLVolumeNode
with nothing in it, i.e. it expects nodes to have that
attribute (and it can be anything).
The fix is to not use the [] operator when accessing values simply for reading but to use the values() method instead.
Added a test along to make sure everything works properly.