mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-19 16:03:02 +08:00
fix(ALTimerTaskManageWidget): 修复删除任务的信号槽参数传递问题
- 修复删除任务的信号槽参数传递问题,此次修复通过 lambda 表达式将当前的 task 作为参数传递,避免了闭包陷阱。
This commit is contained in:
@@ -357,7 +357,7 @@ class ALTimerTaskManageWidget(QWidget, Ui_ALTimerTaskManageWidget):
|
|||||||
item.setData(Qt.UserRole, timer_task)
|
item.setData(Qt.UserRole, timer_task)
|
||||||
widget = ALTimerTaskItemWidget(self, timer_task)
|
widget = ALTimerTaskItemWidget(self, timer_task)
|
||||||
widget.DeleteButton.clicked.connect(
|
widget.DeleteButton.clicked.connect(
|
||||||
lambda _, task = timer_task: self.deleteTask(timer_task)
|
lambda _, task = timer_task: self.deleteTask(task)
|
||||||
)
|
)
|
||||||
if timer_task.get("repeat", False) and hasattr(widget, "HistoryButton"):
|
if timer_task.get("repeat", False) and hasattr(widget, "HistoryButton"):
|
||||||
widget.HistoryButton.clicked.connect(
|
widget.HistoryButton.clicked.connect(
|
||||||
|
|||||||
Reference in New Issue
Block a user