Import 2017-06-07 23:51:09: master 6b315183

Author Committer Branch Timestamp Parent
johan.andruejol johan.andruejol master 2016-10-27 12:55:48 master d4b177c3
Changeset

BUG: Fix issue with qMRMLNodeComboBox when removing an attribute filter

Since QHash [] operator inserts a default-constructed value into the map
if the key is not found and because the [] operator was systematically
used, 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. It now expects nodes to have that
attribute declared (and it can have any value though).

The fix is to not use the [] operator when accessing values simply for
reading but to use the value() method instead.

Added a test along to make sure everything works properly.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@25481 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Libs/MRML/Widgets/Testing/CMakeLists.txt Diff File
add - Libs/MRML/Widgets/Testing/qMRMLNodeComboBoxTest9.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLSortFilterProxyModel.cxx Diff File
mod - Libs/MRML/Widgets/qMRMLSortFilterProxyModel.h Diff File