QT 使用基于 libev 的事件调度器 qt_eventdispatcher_libev

需求 qt 使用高性能事件调度器 解决 可以使用基于 libev 的事件调度器 qt_eventdispatcher_libev 安装 qt_eventdispatcher_libev 在源码目录中新建 eventdispatcher_libev 目录,增加 pri 文件。 复制 https://github.com/sjinks/qt_eventdispatcher_libev 的 src 目录中的文件,删除 win32 等无关文件。 在 pro 文件中,添加 pri 文件 编译看是否有错误。 使用 qt_eventdispatcher_libev main.cpp 中添加头文件 #include "eventdispatcher_libev/eventdispatcher_libev.h" 在 main() 最开始的地方添加 QCoreApplication::setEventDispatcher(new EventDispatcherLibEv()); int main(int argc, char *argv[]) { QCoreApplication::setEventDispatcher(new EventDispatcherLibEv()); QCoreApplication a(argc, argv); return a.exec(); } *注: qt help 中说明 QCoreApplication::setEventDispatcher 使用的地方 That is, before QCoreApplication has been instantiated. * 参考 基于 libev 的 Qt 事件调度器:qt_eventdispatcher_libev...

2023-07-22 · 1 min · 77 words · RamLife