MCPcopy Create free account
hub / github.com/PyQt5/PyQt / run

Method run

QMetaObject/CallInThread.py:29–42  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27 self.requestInterruption()
28
29 def run(self):
30 while not self.isInterruptionRequested():
31 text = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
32 # 通过`invokeMethod`直接调用对应的槽函数
33 # 1. 获取函数`isReadOnly1`返回值, self.parent() 是Window窗口对象
34 # NOTE:注意这里获取返回值要用 `Qt.DirectConnection` 方式
35 retValue = QMetaObject.invokeMethod(self.parent(), 'isReadOnly1',
36 Qt.DirectConnection,
37 Q_RETURN_ARG(bool))
38 # 2. 通过`invokeMethod`队列调用对应控件槽函数`append`
39 argValue = Q_ARG(str, text + ' readOnly: ' + str(retValue))
40 QMetaObject.invokeMethod(self._textBrowser, 'append',
41 Qt.QueuedConnection, argValue)
42 self.sleep(1)
43
44
45class ThreadPy(Thread):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected