! * \brief EventCallProxy::pubEvent Send event objects to * all `handlers` that have subscribed to the topic, * and the `eventProcess` function of the `handler` will be called * \param event * \return true if success */
| 20 | * \return true if success |
| 21 | */ |
| 22 | bool EventCallProxy::pubEvent(const Event &event) |
| 23 | { |
| 24 | bool flag = false; |
| 25 | QList<EventCallProxy::HandlerInfo> &infoGroup = getInfoList(); |
| 26 | for (HandlerInfo &info : infoGroup) { |
| 27 | if (!info.topics.contains(event.topic())) |
| 28 | continue; |
| 29 | if (Q_LIKELY(info.invoke)) { |
| 30 | info.invoke(info, event); |
| 31 | flag = true; |
| 32 | } |
| 33 | } |
| 34 | return flag; |
| 35 | } |
| 36 | |
| 37 | /*! |
| 38 | * \brief EventCallProxy::registerHandler no need for developers to call directly, |
no test coverage detected