# How to add default text to combobox(qMRMLNodeComboBox) before opening any customize model.

**URL:** <https://discourse.slicer.org/t/how-to-add-default-text-to-combobox-qmrmlnodecombobox-before-opening-any-customize-model/17569>\
**Category:** Development\
**Tags:** qt, cli\
**Created:** [May 11, 2021, 1:34pm UTC](https://discourse.slicer.org/t/how-to-add-default-text-to-combobox-qmrmlnodecombobox-before-opening-any-customize-model/17569 "2021-05-11T13:34:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahesh\_Timmanagoudar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mahesh_timmanagoudar/32/10914_2.png) [@Mahesh\_Timmanagoudar](https://discourse.slicer.org/u/Mahesh_Timmanagoudar)\
**Post date:** [May 11, 2021, 1:34pm UTC](https://discourse.slicer.org/t/how-to-add-default-text-to-combobox-qmrmlnodecombobox-before-opening-any-customize-model/17569/1 "2021-05-11T13:34:44Z")

</div>

we have customised model. The GUI is written in XML code. Depending on XML tag qSlicerCLIModuleWidgetPrivate class function is called and dynamically combo box is created. We wanted to add some default text to combo box object. qMRMLNodeComboBox class has setBaseName function. We are able to call the function. But unable to add existing labels as default text. We wanted to add default text label as “Create new Model”. Please refer attached image.

![DefaultText](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/0/00aecc3210e337020d9d4759d35b6b5c2355a53d.png)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [May 11, 2021, 3:41pm UTC](https://discourse.slicer.org/t/how-to-add-default-text-to-combobox-qmrmlnodecombobox-before-opening-any-customize-model/17569/2 "2021-05-11T15:41:00Z")

</div>

qMRMLNodeComboBox has a regular QComboBox, which does not support default text. This feature is only implemented in [ctkComboBox](https://github.com/commontk/CTK/blob/master/Libs/Widgets/ctkComboBox.h#L47).

---

<div class="post-metadata">

**Author:** ![Mahesh\_Timmanagoudar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mahesh_timmanagoudar/32/10914_2.png) [@Mahesh\_Timmanagoudar](https://discourse.slicer.org/u/Mahesh_Timmanagoudar)\
**Post date:** [May 12, 2021, 12:13pm UTC](https://discourse.slicer.org/t/how-to-add-default-text-to-combobox-qmrmlnodecombobox-before-opening-any-customize-model/17569/3 "2021-05-12T12:13:10Z")

</div>

Is it possible to use [ctkComboBox](https://github.com/commontk/CTK/blob/master/Libs/Widgets/ctkComboBox.h#L47) in qMRMLNodeComboBox class?

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 12, 2021, 12:24pm UTC](https://discourse.slicer.org/t/how-to-add-default-text-to-combobox-qmrmlnodecombobox-before-opening-any-customize-model/17569/4 "2021-05-12T12:24:41Z")

</div>

If you use default text of “Create new Model”, won’t that be confusing because it will be separate from the selection in the qMRMLNodeComboBox that is called “Create new Model”?

Can you describe more of your use case? Are you actually just trying to default select the action so that it will create a new model whenever you use your module?
