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:
image
In the .ui file,

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

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)
self.ui.SeedsNodeSelector.setCurrentNode(self._parameterNode.GetNodeReference("SeedPoints"))

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:

self.ui.SeedsNodeSelector.setMRMLScene(slicer.mrmlScene)

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.layout.addWidget(uiWidget)
self.ui = slicer.util.childWidgetVariables(uiWidget)
uiWidget.setMRMLScene(slicer.mrmlScene)

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: