Cannot get a second vtkMRMLNodeComboBox to show nodes

I’m trying to develop a module in which I can choose model nodes as two inputs.
I started from the module automatically created from the Extension Wizard and after setting vtkMRMLModelNode as the nodeType for the vtkMRMLNodeComboBox already included in the example, it works fine. However, I created a second vtkMRMLNodeComboBox with the same attributes (beside the name) underneath and that one cannot list any of the loaded models.
Please find attached some images showing the layout and options.


Thank you for any help

You need to connect the MRML scene changed signal. In Qt Designer press F4 to go to signals and slots mode, then drag&drop a new signal from the very edge of your widget to the MRML node combobox.

Then make these selections:

1 Like

You need to set the scene into MRML widgets, such as the qMRMLNodeComboBox. We typically do this by connecting the mrmlSceneChanged signal of the module widget to the setMRMLScene slot of the MRML node selector widget. See details on slide 44 of the PerkLab bootcamp Slicer programming tutorial:

1 Like

Thank you both for your help !

Hi @lassoan,
I am a beginner learning Slicer module development.
Now, I’d like to add a qMRMLVolumeThresholdWidget to my UI. However, when I try to connect the mrmlSceneChanged signal to the setMRMLScene slot. I found there’s seems no setMRMLScene slot:

Could you please tell me what to do with that?
Thank you so much!

Enable the Show signals and slots inherited... checkbox. If there is still no setMRMLScene slot then it means that the widget does not need setting of the MRML scene, it is enough to set the volume node using setMRMLVolumeNode. If you connect your volume node selector’s node selected signal to the volume setting slot of the threshold widget then everything should work.