-void EventManager::processEvents() {
- // we only process one event at a time for now, and let Qt's own event processing come in between
- if(_eventQueue.isEmpty())
- return;
- dispatchEvent(_eventQueue.first());
- _eventQueue.removeFirst();
- if(_eventQueue.count())
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
- else
- emit eventQueueEmptied();
+void EventManager::processEvent(Event *event) {
+ Q_ASSERT(_eventQueue.isEmpty());
+ dispatchEvent(event);
+ // dispatching the event might cause new events to be generated. we process those afterwards.
+ while(!_eventQueue.isEmpty()) {
+ dispatchEvent(_eventQueue.first());
+ _eventQueue.removeFirst();
+ }