qMRMLNodeComboBox doesn't work

Hello everyone, I’m trying to add a new qMRMLNodeComboBox in my extension. However it seems doesn’t work. Like this:
In the .ui file,

<widget class="qMRMLNodeComboBox" name="SeedsNodeSelector">
        <property name="enabled">
        <property name="toolTip">
         <string>Select the seed point to refine</string>
        <property name="nodeTypes">
        <property name="showChildNodeTypes">
        <property name="noneEnabled">

When I set the property “enabled” as True, it got nothing in list.
My code about it has been shown below:

 self.ui.SeedsNodeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.updateParameterNodeFromGUI)
self._parameterNode.SetNodeReferenceID("SeedPoints", self.ui.SeedsNodeSelector.currentNodeID)

How to deal with it?
Thanks for any help!

Hello. Try setting the MRML Scene for your qMRMLNodeComboBox and see if it helps. In your code, it would be something like:


Oh, yes, it works! Thank you very much!
But I can’t understand it, because I have set them all before:

uiWidget = slicer.util.loadUI(self.resourcePath('UI/Unet_test.ui'))
self.ui = slicer.util.childWidgetVariables(uiWidget)

Whatever, thanks for your help.

If you look closely you see that you set it to the wrong object. It is important to be set to the MRML node combobox, instead you set it to the uiWidget object. For automatic propagation of the scene you can add mrmlSceneChanged->setMRMLScene signal/slot.

Okay, I get it, thank you. :grinning: