libgitlevtbus is an open-source event bus (or message bus) based on Qt under BSD lisence.
- Easy to use (c++11 feature supported: lambda expression, member function callback, ...)
- Custom event support (carry custom arguments)
- Events can be deliverd across threads
Qt 5.1.0 or later with MSVC, gcc or intel complier
c++11 support required
See examples/examples.pro
#include "gitlmodual.h"
#include <QDebug>
int main(int argc, char *argv[])
{
GitlModual cModual;
/// subscribe to an event
cModual.subscribeToEvtByName("I am a test event",
[](GitlEvent& rcEvt)->bool
{
qDebug() << "Hello GitlEvtBus!";
return true;
}
);
GitlEvent cEvent("I am a test event"); ///< create an event
cEvent.dispatch(); ///< dispatch
/// output: "Hello GitlEvtBus!"
return 0;
}
For more, you may refer to the code in test/testcase.cpp