Commit 2f5e23be authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Prevent closing event in the MDI area

parent 045a3337
......@@ -1952,7 +1952,9 @@ class OG_MainWindow(QtGui.QMainWindow, object):
messages.itemClicked.connect(self.view.show_item)
self.mdi_area = self.findChild(QtGui.QMdiArea, 'mdiArea')
self.sub_mdi = self.mdi_area.subWindowList()
self.filter_event = FilterEvent()
for each in self.sub_mdi:
each.widget().installEventFilter(self.filter_event)
if each.widget() != process_widget:
self.statechart_mdi = each
self.mdi_area.subWindowActivated.connect(self.upd_statechart)
......@@ -2105,6 +2107,15 @@ class OG_MainWindow(QtGui.QMainWindow, object):
LOG.debug('Bye bye!')
super(OG_MainWindow, self).closeEvent(event)
class FilterEvent(QtCore.QObject):
def eventFilter(self, obj, event):
''' Used to intercept the close event sent of the Mdi windows '''
if event.type() == QtCore.QEvent.Close:
event.ignore()
return True
else:
return QtCore.QObject.eventFilter(self, obj, event)
def parse_args():
''' Parse command line arguments '''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment