# How to change the default file format for save

**URL:** https://discourse.slicer.org/t/how-to-change-the-default-file-format-for-save/46278
**Category:** Development
**Tags:** save, data-dialog
**Created:** [February 25, 2026, 6:31am UTC](https://discourse.slicer.org/t/how-to-change-the-default-file-format-for-save/46278 "2026-02-25T06:31:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Victor\_Wayne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/victor_wayne/32/80778_2.png) [@Victor\_Wayne](https://discourse.slicer.org/u/Victor_Wayne)
#### Post date: [February 25, 2026, 6:31am UTC](https://discourse.slicer.org/t/how-to-change-the-default-file-format-for-save/46278/1 "2026-02-25T06:31:59Z")

</div>

Hello,

When we click on the save button the default file format for saving a scene is .mrml. Is there any way I can change it to .mrb? Is there a way to edit the config file so that the save data dialog opens with .mrb file format to save?

I am willing to edit the qSlicerSaveDataDialog.cxx file and maintain it, if it is like one or two line edit. If that is the only case please tell me how to do it. Or should I subclass the save data dialog and make my own save widget? If so please instruct me on how to do it.

Thanks for your help in advance.

---

<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: [February 25, 2026, 2:12pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-file-format-for-save/46278/2 "2026-02-25T14:12:10Z")

</div>

I was curious as well so did a brief chat with GitHub Copilot. Here is the relevant part of the results, maybe it helps:

… but **not as a simple “default extension setting” in the Save dialog UI** —to _force_ a default (your option **B** ) you typically need either:

1. a **small core change** in Slicer (recommended if you control the build), or
2. a **scripted override of the scene save dialog** (works without rebuilding, but it replaces the standard dialog behavior).

Below is what the current Slicer code is doing and where you’d change it.

* * *

## 1) MRML vs MRB default in the Save dialog (“Save scene and unsaved data”)

That dialog is implemented here:

```cpp
void qSlicerSaveDataDialogPrivate::saveSceneAsDataBundle()
{
  int sceneRow = this->findSceneRow();
  QComboBox* box = qobject_cast<QComboBox*>(this->FileWidget->cellWidget(sceneRow, FileFormatColumn));
  int mrbIndex = box->findText("mrb", Qt::MatchContains);
  int mrmlIndex = box->findText("mrml", Qt::MatchContains);
  // Toggle between scene data bundle entry and mrml entry
  if (mrbIndex != -1)
  {
    if (box->currentIndex() != mrbIndex)
    {
      box->setCurrentIndex(mrbIndex);
    }
    else
    {
      if (mrmlIndex != -1)
      {
        box->setCurrentIndex(mrmlIndex);
      }
    }
  }
}

```

Key point: **MRB is currently a “toggle button” behavior** , not a persisted “default”. So “force MRB always” is not exposed as a preference; you’d need to change logic so that on dialog initialization/population it _sets_ the scene’s file format combobox to MRB and (optionally) disables toggling back.

### What to change (core approach)

You’d look for where the scene row is populated (e.g., `populateScene()` / `populateItems()` in the same file) and make it do something like:

- find the scene row combobox
- set it to the `mrb` entry unconditionally
- optionally call the logic that hides other rows when MRB is selected (since MRB implies bundling; Slicer already has code that hides non-scene rows when saving as MRB)

There is already code that hides other rows when saving as MRB:

```cpp
// When scene is saved as .mrb then item selection state,
// file format, and options may be ignored. To indicate
// this clearly to the users, we only show the scene in the table
// and hide all the other storable nodes.

```

So the feature is conceptually supported; it’s just not “force MRB by default”.

### Alternative (no rebuild): override the scene save dialog

Slicer supports overriding the default scene save dialog from a scripted module. This is documented here:

````markdown
### Override default scene save dialog

Place this class in the scripted module file to override

```python
class MyModuleFileDialog ():
  ...
  def execDialog(self):
    # Implement custom scene save operation here.
    ...
```

````

With that approach you could implement “Save always writes an .mrb” (for example by calling `slicer.util.saveScene("something.mrb")`)—but it replaces the normal dialog, so it’s a heavier UX change.

---

<div class="post-metadata">

### Author: ![Victor\_Wayne](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/victor_wayne/32/80778_2.png) [@Victor\_Wayne](https://discourse.slicer.org/u/Victor_Wayne)
#### Post date: [February 28, 2026, 4:01am UTC](https://discourse.slicer.org/t/how-to-change-the-default-file-format-for-save/46278/3 "2026-02-28T04:01:31Z")

</div>

Thanks a lot, Pinter.  
I was able to follow your suggestions and customize the save data dialog.  
I took the logic in the `saveSceneAsDataBundle` (the gist of it) and put it in the `populateItems` function and now whenever I click on the save data button it prompts me to save the scene in .mrb format by default.

Thanks.
