Skip to content

Commit a7460cb

Browse files
sltlalamuziing
authored andcommitted
修正state判断错误,Qt.Checked.value才是int类型
1 parent dbfa3ff commit a7460cb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

03-QtWidgets-常用控件/02-Button-按钮控件/04-QCheckBox-复选框/03-QCheckBox-信号.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def test_01(self) -> None:
3030

3131
@QtCore.Slot(int)
3232
def test_slot(state: int) -> None:
33-
if state == Qt.Checked:
33+
if state == Qt.Checked.value:
3434
print("复选框被选中了!")
35-
elif state == Qt.Unchecked:
35+
elif state == Qt.Unchecked.value:
3636
print("复选框被取消选中了!")
37-
elif state == Qt.PartiallyChecked:
37+
elif state == Qt.PartiallyChecked.value:
3838
print("复选框被部分选中!")
3939

4040
self.cb.stateChanged.connect(test_slot) # type: ignore

0 commit comments

Comments
 (0)