# Bypassing the save dialog box on exit from a ScriptedLoadableModule

**URL:** <https://discourse.slicer.org/t/bypassing-the-save-dialog-box-on-exit-from-a-scriptedloadablemodule/15030>\
**Category:** Development\
**Created:** [December 12, 2020, 9:54pm UTC](https://discourse.slicer.org/t/bypassing-the-save-dialog-box-on-exit-from-a-scriptedloadablemodule/15030 "2020-12-12T21:54:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [December 13, 2020, 12:27am UTC](https://discourse.slicer.org/t/bypassing-the-save-dialog-box-on-exit-from-a-scriptedloadablemodule/15030/2 "2020-12-13T00:27:18Z")

</div>

Hi Hina!

I did some work to override the Slicer drag and drop behavior to do something different that I posted about at

> [@Add Drag and drop import to slicelet?](https://discourse.slicer.org/t/add-drag-and-drop-import-to-slicelet/9382/4):
>
> I came across this thread as I was experimenting adding a custom drop action for a custom app using only python. With the code below I was able to redefine the drop action to execute what I put in dropEvent when I dropped a file path instead of the Slicer default of opening the Add Data Dialog. class MyClass(qt.QWidget): def eventFilter(self, object, event): """ Custom event filter for Slicer Main Window. Inputs: Object (QObject), Event (QEvent) """ …

You should be able to use this method for overriding the QMainWindow `closeEvent` to do your own set of actions instead of the Slicer unsaved changes warning.

Here is some [example code](https://github.com/Slicer/Slicer/blob/39fe1598d1fa2e5dcf51a712cdcdcfe7c0ce446e/Modules/Scripted/DICOM/DICOM.py#L479-L525) that @lassoan then used in the DICOM module to override the regular Slicer drag and drop event behavior.

---

_[View the full topic](https://discourse.slicer.org/t/bypassing-the-save-dialog-box-on-exit-from-a-scriptedloadablemodule/15030)._
