June 2018
Intermediate to advanced
348 pages
8h 45m
English
The code to subscribe to the rxcpp::observable of mouse events is as follows:
The program is as follows:
// Display the mouse move message and the mouse coordinates
rxevt::from(label_mouseArea, QEvent::MouseMove)
.subscribe([&label_coordinates](const QEvent* e){
auto me = static_cast<const QMouseEvent*>(e);
label_coordinates->setText(QString("Mouse Moving : X = %1, Y = %2")
.arg(me->x())
.arg(me->y()));
});
The rxevt::from() function returns the rxcpp::observable of the events from label_mouseArea, based on the QEvent::Type we are passing as the argument. In this code, we are subscribing to an Observable of events in label_mouseArea, which are of the ...
Read now
Unlock full access