PySide.QtCore.QAbstractEventDispatcher class provides an interface to manage Qt's event queue.
事件分派程序从窗口系统和其他源接收事件。然后把它们发送给 PySide.QtCore.QCoreApplication or PySide.QtGui.QApplication instance for processing and delivery. PySide.QtCore.QAbstractEventDispatcher provides fine-grained control over event delivery.
对于事件处理的简单控制,请使用 QCoreApplication.processEvents() .
为更好地控制应用程序的事件循环,调用 PySide.QtCore.QAbstractEventDispatcher.instance() and call functions on the PySide.QtCore.QAbstractEventDispatcher object that is returned. If you want to use your own instance of PySide.QtCore.QAbstractEventDispatcher or of a PySide.QtCore.QAbstractEventDispatcher subclass, you must create your instance before you create the PySide.QtGui.QApplication 对象。
启动 main 事件循环通过调用 QCoreApplication.exec() , and stopped by calling QCoreApplication.exit() . Local event loops can be created using PySide.QtCore.QEventLoop .
履行长时间操作的程序可以调用 PySide.QtCore.QAbstractEventDispatcher.processEvents() with a bitwise OR combination of various QEventLoop.ProcessEventsFlag 值去控制应该交付哪些事件。
PySide.QtCore.QAbstractEventDispatcher also allows the integration of an external event loop with the Qt event loop. For example, the Motif Extension includes a reimplementation of PySide.QtCore.QAbstractEventDispatcher that merges Qt and Motif events together.
| 参数: | parent – PySide.QtCore.QObject |
|---|
构造新事件分派程序采用给定 parent .
Flushes the event queue. This normally returns almost immediately. Does nothing on platforms other than X11.
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if there is an event waiting; otherwise returns false.
| 参数: | thread – PySide.QtCore.QThread |
|---|---|
| 返回类型: | PySide.QtCore.QAbstractEventDispatcher |
Returns a pointer to the event dispatcher object for the specified thread 。若 thread is zero, the current thread is used. If no event dispatcher exists for the specified thread, this function returns 0.
注意
If Qt is built without thread support, the thread argument is ignored.
Interrupts event dispatching; i.e. the event dispatcher will return from PySide.QtCore.QAbstractEventDispatcher.processEvents() as soon as possible.
| 参数: | flags – PySide.QtCore.QEventLoop.ProcessEventsFlags |
|---|---|
| 返回类型: | PySide.QtCore.bool |
| 参数: | notifier – PySide.QtCore.QSocketNotifier |
|---|
注册 notifier with the event loop. Subclasses must implement this method to tie a socket notifier into another event loop.
| 参数: |
|
|---|
注册计时器采用指定 timerId and interval 为给定 object .
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.int |
Registers a timer with the specified interval 为给定 object .
| 参数: | object – PySide.QtCore.QObject |
|---|---|
| 返回类型: |
返回注册计时器列表为 object . The timer ID is the first member in each pair; the interval is the second.
| 参数: | notifier – PySide.QtCore.QSocketNotifier |
|---|
Unregisters notifier from the event dispatcher. Subclasses must reimplement this method to tie a socket notifier into another event loop. Reimplementations must call the base implementation.
| 参数: | timerId – PySide.QtCore.int |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Unregisters the timer with the given timerId . Returns true if successful; otherwise returns false.
| 参数: | object – PySide.QtCore.QObject |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Unregisters all the timers associated with the given object . Returns true if all timers were successful removed; otherwise returns false.
唤醒事件循环。