+ _eventQueue.append(event);
+ if(_eventQueue.count() == 1) // we're not currently processing another event
+ processEvents();
+}
+
+void EventManager::customEvent(QEvent *event) {
+ if(event->type() == QEvent::User) {
+ processEvents();
+ event->accept();
+ }
+}
+
+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));