mirror of
https://github.com/muziing/PySide6-Code-Tutorial.git
synced 2025-01-30 14:22:53 +08:00
Fix Mypy error: 通过type:ignore
注释解决Mypy对控件信号误报错的问题
This commit is contained in:
parent
6fca8d10eb
commit
3d0cd98f69
@ -57,7 +57,7 @@ class MyWidget(QtWidgets.QWidget):
|
||||
# ******************
|
||||
|
||||
# 将按钮的点击信号与槽函数绑定,按钮按下则执行槽函数
|
||||
btn.clicked.connect(test_slot)
|
||||
btn.clicked.connect(test_slot) # type: ignore
|
||||
|
||||
def test_03(self) -> None:
|
||||
"""测试获取尺寸功能"""
|
||||
|
@ -27,7 +27,7 @@ class MyWidget(QtWidgets.QWidget):
|
||||
def setup_ui(self) -> None:
|
||||
"""设置界面"""
|
||||
self.button = QtWidgets.QPushButton("点击我!", self)
|
||||
self.button.clicked.connect(lambda: print("按钮被点击了"))
|
||||
self.button.clicked.connect(lambda: print("按钮被点击了")) # type: ignore
|
||||
self.button.move(50, 200)
|
||||
self.label_1 = QtWidgets.QLabel("PySide", self)
|
||||
self.label_1.move(150, 50)
|
||||
|
@ -46,7 +46,8 @@ class MyWidget(QtWidgets.QWidget):
|
||||
# self.label_1.raise_() # 提高label_1的层级
|
||||
self.label_2.stackUnder(self.label_1) # 使得2在1之下
|
||||
|
||||
button.clicked.connect(test_slot) # 连接按钮点击信号与槽函数
|
||||
# 连接按钮点击信号与槽函数
|
||||
button.clicked.connect(test_slot) # type: ignore
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -45,8 +45,8 @@ class MyWidget(QtWidgets.QWidget):
|
||||
button.resize(150, 150)
|
||||
button.move(100, 100) # 移动按钮控件的位置
|
||||
|
||||
# 将按钮被点击的槽与lambda槽函数连接
|
||||
button.clicked.connect(lambda: print("按钮被点击了"))
|
||||
# 将按钮被点击的信号与lambda槽函数连接
|
||||
button.clicked.connect(lambda: print("按钮被点击了")) # type: ignore
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user