信号连接数量

This commit is contained in:
Irony 2020-05-21 10:13:50 +08:00
parent 4615ab72f8
commit 3d210e4d4b
4 changed files with 6 additions and 5 deletions

View file

@ -34,11 +34,11 @@ class Window(QWidget):
def doTest(self):
self.retView.append("""
# button1 clicked 是否连接: %s
# button2 clicked 是否连接: %s
# button1 clicked 是否连接: %s, %s
# button2 clicked 是否连接: %s, %s
""" % (
self.isSignalConnected(self.button1, 'clicked()'),
self.isSignalConnected(self.button2, 'clicked()')
self.isSignalConnected(self.button1, 'clicked()'), self.button1.receivers(self.button1.clicked) > 0,
self.isSignalConnected(self.button2, 'clicked()'), self.button2.receivers(self.button2.clicked) > 0,
))
def isSignalConnected(self, obj, name):

View file

@ -204,7 +204,8 @@ PyQt 结合 Opencv 进行人脸检测;
## 20、判断信号是否连接
[运行 IsSignalConnected.py](IsSignalConnected.py)
通过 `isSignalConnected` 判断是否连接
1. 通过 `isSignalConnected` 判断是否连接
2. 通过对象的 `receivers` 获取连接的数量来判断
![IsSignalConnected](ScreenShot/IsSignalConnected.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 KiB