core & ui_qt: switch to the new event system, fix thread-safe issue