PySide.QtCore.QEventLoop class provides a means of entering and leaving an event loop.
At any time, you can create a PySide.QtCore.QEventLoop object and call exec() on it to start a local event loop. From within the event loop, calling PySide.QtCore.QEventLoop.exit() will force exec() to return.
| 参数: | parent – PySide.QtCore.QObject |
|---|
构造事件循环对象采用给定 parent .
此枚举控制处理事件的类型通过 PySide.QtCore.QEventLoop.processEvents() 函数。
| 常量 | 描述 |
|---|---|
| QEventLoop.AllEvents | 所有事件。注意: DeferredDelete 事件会被特殊处理。见 QObject.deleteLater() 了解更多细节。 |
| QEventLoop.ExcludeUserInputEvents | 不处理用户输入事件,譬如 ButtonPress 和 KeyPress。注意,事件未被丢弃;会交付他们当下次 PySide.QtCore.QEventLoop.processEvents() is called without the ExcludeUserInputEvents 标志。 |
| QEventLoop.ExcludeSocketNotifiers | 不处理套接字通知事件。注意,事件未被丢弃;会交付他们当下次 PySide.QtCore.QEventLoop.processEvents() is called without the ExcludeSocketNotifiers 标志。 |
| QEventLoop.WaitForMoreEvents | 等待事件,若没有待决事件可用。 |
| QEventLoop.DeferredDeletion | deprecated - do not use. |
| 参数: | flags – PySide.QtCore.QEventLoop.ProcessEventsFlags |
|---|---|
| 返回类型: | PySide.QtCore.int |
| 参数: | returnCode – PySide.QtCore.int |
|---|
告诉事件循环,采用返回代码退出。
在此函数被调用之后,事件循环返回从调用 exec() 。 exec() function returns returnCode .
按约定, returnCode 0 意味着成功,而任何非零值指示出错。
注意:不像同名 C 库函数,此函数 does return to the caller – it is event processing that stops.
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if the event loop is running; otherwise returns false. The event loop is considered running from the time when exec() is called until PySide.QtCore.QEventLoop.exit() 被调用。
另请参阅
| 参数: | flags – PySide.QtCore.QEventLoop.ProcessEventsFlags |
|---|---|
| 返回类型: | PySide.QtCore.bool |
| 参数: |
|
|---|
告诉事件循环要正常退出。
如同 exit(0)。
唤醒事件循环。