2015-12-20 22 views
2

在某些移動系統上,當應用程序處於後臺時它可能會暫停(它也可能被終止,但這不是此問題的一部分)。如果Qt 5事件循環暫停,則排隊全局事件

如果後臺服務,傳感器等在事件隊列處於非活動狀態時發送到事件隊列,會發生什麼情況?發帖事件是這樣的:

QCoreApplication::postEvent(QCoreApplication::instance(), event); 

是事件緩存,並有高速緩存的事件(除了內存)的數量有限?

Regards,

回答

1

當主線程暫停時,事件應該正確排隊。從source codepostEvent的:

Adds the event \a event, with the object \a receiver as the 
receiver of the event, to an event queue and returns immediately. 

When control returns to the main event loop, all events that are 
stored in the queue will be sent using the notify() function.