code: def closeEvent(self, event):
          
          if not self.viewWidget().canClose():
              event.ignore()
          else:
              super(XViewDialog, self).closeEvent(event)
docs: Checks to make sure that the view widget can be properly closed.
          
          :param      event | <QCloseEvent>