Integrating the RxCpp library with the Qt event model
We already saw the Qt framework from a bird's eye view in the previous sections. We learned how to handle Qt events, especially mouse events and the signals/slots mechanism. We also learned about the RxCpp
library and its programming model in the previous two chapters. In the process, we came across many significant reactive operators that matter while writing programs leveraging the reactive approach.
In this section, we are going to write an application to handle mouse events in a label widget, which is similar to the previous example. In this example, instead of handling mouse events to emit signals (like we did in the last example), we will be subscribing to Qt mouse events using the RxCpp
subscriber and will filter different mouse events from the resultant mouse events Stream. The events (that are not filtered out) will be related to the subscribers.
Qt event filter – a reactive approach
As mentioned previously, the Qt framework has...