moninj: set parent to main window on widget delete

This commit is contained in:
Simon Renblad 2024-07-02 13:15:09 +08:00 committed by Sebastien Bourdeauducq
parent de1da7efb3
commit 6c28159541

View File

@ -861,9 +861,10 @@ class _MonInjDock(QDockWidgetCloseDetect):
def delete_widget(self, index, checked): def delete_widget(self, index, checked):
widget = self.flow.itemAt(index).widget() widget = self.flow.itemAt(index).widget()
widget.hide()
self.manager.dm.setup_monitoring(False, widget) self.manager.dm.setup_monitoring(False, widget)
self.flow.layout.takeAt(index) self.flow.layout.takeAt(index)
widget.setParent(self.manager.main_window)
widget.hide()
def add_channels(self): def add_channels(self):
channels = self.channel_dialog.channels channels = self.channel_dialog.channels
@ -948,7 +949,7 @@ class MonInj:
del self.docks[name] del self.docks[name]
self.update_closable() self.update_closable()
dock.delete_all_widgets() dock.delete_all_widgets()
dock.hide() # dock may be parent, only delete on exit dock.deleteLater()
def update_closable(self): def update_closable(self):
flags = (QtWidgets.QDockWidget.DockWidgetMovable | flags = (QtWidgets.QDockWidget.DockWidgetMovable |