Skip to content

The only downloader you need. 下载器的集大成者。

refactor(app): 为自定义对话框组件添加关闭时删除属性

XiaoYouChR1820d8b2224c
diff --git a/app/components/custom_dialogs.py b/app/components/custom_dialogs.py
index 107b453e..f37819a7 100644
--- a/app/components/custom_dialogs.py
+++ b/app/components/custom_dialogs.py
@@ -1,7 +1,7 @@
import os
import sys
-from PySide6.QtCore import Signal
+from PySide6.QtCore import Signal, Qt
from PySide6.QtWidgets import QFileDialog, QApplication
from qfluentwidgets import CheckBox, MessageBox, ComboBox, MessageBoxBase, SubtitleLabel, InfoBar, InfoBarPosition
@@ -15,6 +15,7 @@ class DelDialog(MessageBox):
def __init__(self, parent=None):
super().__init__(title="删除下载任务", content="确定要删除下载任务吗?", parent=parent)
self.setClosableOnMaskClicked(True)
+ self.setAttribute(Qt.WA_DeleteOnClose)
self.checkBox = CheckBox("彻底删除", self)
self.textLayout.addWidget(self.checkBox)
@@ -25,6 +26,7 @@ class CustomInputDialog(MessageBox):
super().__init__(title, content, parent)
self.widget.setFixedSize(300, 150)
self.setClosableOnMaskClicked(True)
+ self.setAttribute(Qt.WA_DeleteOnClose)
self.comboBox = ComboBox(self)
self.comboBox.addItems(items)
@@ -42,6 +44,7 @@ class EditHeadersDialog(MessageBoxBase):
def __init__(self, parent=None, initialHeaders=None):
super().__init__(parent=parent)
self.setClosableOnMaskClicked(True)
+ self.setAttribute(Qt.WA_DeleteOnClose)
self.widget.setFixedSize(400, 500)
@@ -95,6 +98,7 @@ class PlanTaskDialog(MessageBoxBase, Ui_PlanTaskDialog):
self.setupUi(self.viewLayout)
self.widget.setFixedSize(410, 275)
+ self.setAttribute(Qt.WA_DeleteOnClose)
self.setClosableOnMaskClicked(True)
# Connect signals to slots