I’d like to programmatically assign a subject hierarchy group to a qMRMLSubjectHierarchyComboBox in my module. After setting SlicerParameterName property to hNode, in designer I add hNode to my parameterNodeWrapper
hNode: vtkMRMLSubjectHierarchyNode
with appropriate import.
However… at module reload:
RuntimeError: Unable to create GUI connector from datatype '<class 'MRMLCorePython.vtkMRMLSubjectHierarchyNode'>' to widget type '<class 'PythonQt.qSlicerSubjectHierarchyModuleWidgets.qMRMLSubjectHierarchyComboBox'>'. To determine which data types can be connected to which widget types, please check 'canRepresent' methods in 'GuiConnector' classes in these files: C:\Users\amorton1\AppData\Local\slicer.org\Slicer 5.8.1\lib\Slicer-5.8\qt-scripted-modules\SubjectHierarchyLib\parameterNodeWrapper\guiConnectors.py,
Which indicates
def canRepresent(widget, datatype) -> bool:
return type(widget) == qMRMLSubjectHierarchyTreeView and isNodeOrUnionOfNodes(datatype)
I’m a bit stuck
Is there an appropriate data type I can assign to hNode in my parameterNodeWrapper ?