mirror of
https://github.com/muziing/PySide6-Code-Tutorial.git
synced 2025-01-30 14:22:53 +08:00
修正state判断错误,Qt.Checked.value才是int类型
This commit is contained in:
parent
dbfa3ffd1f
commit
a7460cbdb1
@ -30,11 +30,11 @@ class MyWidget(QtWidgets.QWidget):
|
||||
|
||||
@QtCore.Slot(int)
|
||||
def test_slot(state: int) -> None:
|
||||
if state == Qt.Checked:
|
||||
if state == Qt.Checked.value:
|
||||
print("复选框被选中了!")
|
||||
elif state == Qt.Unchecked:
|
||||
elif state == Qt.Unchecked.value:
|
||||
print("复选框被取消选中了!")
|
||||
elif state == Qt.PartiallyChecked:
|
||||
elif state == Qt.PartiallyChecked.value:
|
||||
print("复选框被部分选中!")
|
||||
|
||||
self.cb.stateChanged.connect(test_slot) # type: ignore
|
||||
|
Loading…
x
Reference in New Issue
Block a user