PySide6.QtCore.QAbstractEventDispatcher¶
- class QAbstractEventDispatcher¶
- The - QAbstractEventDispatcherclass provides an interface to manage Qt’s event queue. More_…- Synopsis¶- Methods¶- def - __init__()
- def - registerTimer()
 - Virtual methods¶- def - closingDown()
- def - interrupt()
- def - processEvents()
- def - registerTimer()
- def - remainingTime()
- def - startingUp()
- def - wakeUp()
 - Signals¶- def - aboutToBlock()
- def - awake()
 - Static functions¶- def - instance()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- An event dispatcher receives events from the window system and other sources. It then sends them to the - QCoreApplicationor QApplication instance for processing and delivery.- QAbstractEventDispatcherprovides fine-grained control over event delivery.- For simple control of event processing use - processEvents().- For finer control of the application’s event loop, call - instance()and call functions on the- QAbstractEventDispatcherobject that is returned. If you want to use your own instance of- QAbstractEventDispatcheror of a- QAbstractEventDispatchersubclass, you must install it with- setEventDispatcher()or- setEventDispatcher()before a default event dispatcher has been installed.- The main event loop is started by calling - exec(), and stopped by calling- exit(). Local event loops can be created using- QEventLoop.- Programs that perform long operations can call - processEvents()with a bitwise OR combination of various- ProcessEventsFlagvalues to control which events should be delivered.- QAbstractEventDispatcheralso allows the integration of an external event loop with the Qt event loop.- See also - Constructs a new event dispatcher with the given - parent.- aboutToBlock()¶
 - This signal is emitted before the event loop calls a function that could block. - See also - awake()¶
 - This signal is emitted after the event loop returns from a function that could block. - See also - closingDown()¶
 - filterNativeEvent(eventType, message, result)¶
- Parameters:
- eventType – - QByteArray
- message – - void
- result – - qintptr
 
- Return type:
- bool 
 
 - Sends - messagethrough the event filters that were set by- installNativeEventFilter(). This function returns- trueas soon as an event filter returns- true, and false otherwise to indicate that the processing of the event should continue.- Subclasses of - QAbstractEventDispatchermust call this function for all messages received from the system to ensure compatibility with any extensions that may be used in the application. The type of event- eventTypeis specific to the platform plugin chosen at run-time, and can be used to cast message to the right type. The- resultpointer is only used on Windows, and corresponds to the LRESULT pointer.- Note that the type of - messageis platform dependent. See- QAbstractNativeEventFilterfor details.- installNativeEventFilter(filterObj)¶
- Parameters:
- filterObj – - QAbstractNativeEventFilter
 
 - Installs an event filter - filterObjfor all native events received by the application.- The event filter - filterObjreceives events via its- nativeEventFilter()function, which is called for all events received by all threads.- The - nativeEventFilter()function should return true if the event should be filtered, (in this case, stopped). It should return false to allow normal Qt processing to continue: the native event can then be translated into a- QEventand handled by the standard Qt- eventfiltering, e.g.- installEventFilter().- If multiple event filters are installed, the filter that was installed last is activated first. - Note - The filter function set here receives native messages, that is, MSG or XEvent structs. - For maximum portability, you should always try to use - QEventobjects and- installEventFilter()whenever possible.- See also - Returns a pointer to the event dispatcher object for the specified - thread. If- threadis- None, the current thread is used. If no event dispatcher exists for the specified thread, this function returns- None.- Note - If Qt is built without thread support, the - threadargument is ignored.- abstract interrupt()¶
 - Interrupts event dispatching. The event dispatcher will return from - processEvents()as soon as possible.- abstract processEvents(flags)¶
- Parameters:
- flags – Combination of - ProcessEventsFlag
- Return type:
- bool 
 
 - Processes pending events that match - flagsuntil there are no more events to process. Returns- trueif an event was processed; otherwise returns- false.- This function is especially useful if you have a long running operation, and want to show its progress without allowing user input by using the - ExcludeUserInputEventsflag.- If the - WaitForMoreEventsflag is set in- flags, the behavior of this function is as follows:- If events are available, this function returns after processing them. 
- If no events are available, this function will wait until more are available and return after processing newly available events. 
 - If the - WaitForMoreEventsflag is not set in- flags, and no events are available, this function will return immediately.- Note - This function does not process events continuously; it returns after all available events are processed. - abstract registerSocketNotifier(notifier)¶
- Parameters:
- notifier – - QSocketNotifier
 
 - Registers - notifierwith the event loop. Subclasses must implement this method to tie a socket notifier into another event loop.- registerTimer(interval, timerType, object)¶
 - This function will be removed in Qt 7. Use the overload taking Duration . - Registers a timer with the specified - intervaland- timerTypefor the given- objectand returns the timer id.- abstract registerTimer(timerId, interval, timerType, object)
 - Register a timer with the specified - timerId,- interval, and- timerTypefor the given- object.- abstract registeredTimers(object)¶
- Parameters:
- object – - QObject
- Return type:
- .list of QAbstractEventDispatcher.TimerInfo 
 
 - Returns a list of registered timers for - object. The TimerInfo struct has- timerId,- interval, and- timerTypemembers.- See also - abstract remainingTime(timerId)¶
- Parameters:
- timerId – int 
- Return type:
- int 
 
 - Returns the remaining time in milliseconds with the given - timerId. If the timer is inactive, the returned value will be -1. If the timer is overdue, the returned value will be 0.- See also - removeNativeEventFilter(filterObj)¶
- Parameters:
- filterObj – - QAbstractNativeEventFilter
 
 - Removes the event filter - filterfrom this object. The request is ignored if such an event filter has not been installed.- All event filters for this object are automatically removed when this object is destroyed. - It is always safe to remove an event filter, even during event filter filter activation (that is, even from within the - nativeEventFilter()function).- startingUp()¶
 - abstract unregisterSocketNotifier(notifier)¶
- Parameters:
- notifier – - QSocketNotifier
 
 - Unregisters - notifierfrom the event dispatcher. Subclasses must reimplement this method to tie a socket notifier into another event loop. Reimplementations must call the base implementation.- Unregisters the timer with the given - timerId. Returns- trueif successful; otherwise returns- false.- See also - abstract unregisterTimer(timerId)
- Parameters:
- timerId – int 
- Return type:
- bool 
 
 - Unregisters the timer with the given - timerId. Returns- trueif successful; otherwise returns- false.- See also - Unregisters all the timers associated with the given - object. Returns- trueif all timers were successfully removed; otherwise returns- false.- See also - abstract wakeUp()¶
 - Wakes up the event loop. - See also - class TimerInfo¶
- Synopsis¶- Methods¶- def - __init__()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- PySide6.QtCore.QAbstractEventDispatcher.TimerInfo.timerId¶
 - PySide6.QtCore.QAbstractEventDispatcher.TimerInfo.interval¶
 - PySide6.QtCore.QAbstractEventDispatcher.TimerInfo.timerType¶
 - Constructs a - TimerInfostruct with the given- timerId,- interval, and- timerType.