Add closeEvents to dialogs and set the deleteLater command

This commit is contained in:
Veronica Berglyd Olsen
2023-11-28 16:29:21 +01:00
parent 50a9b5b5e2
commit ff7f27ff97
20 changed files with 144 additions and 106 deletions
+13 -1
View File
@@ -26,7 +26,8 @@ from __future__ import annotations
import logging
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtCore import Qt, QSize, pyqtSlot
from PyQt5.QtWidgets import (
QAbstractItemView, QDialog, QDialogButtonBox, QGridLayout, QLabel,
QListWidget, QListWidgetItem, QVBoxLayout, QWidget
@@ -125,10 +126,21 @@ class GuiDocMerge(QDialog):
return self._data
##
# Events
##
def closeEvent(self, event: QCloseEvent) -> None:
"""Capture the close event and perform cleanup."""
event.accept()
self.deleteLater()
return
##
# Private Slots
##
@pyqtSlot()
def _resetList(self) -> None:
"""Reset the content of the list box to its original state."""
logger.debug("Resetting list box content")