How to make a QQuickItem which will route mouse events to other QuickItem?
-
I do not understand the right approach of QMouseEvent and QTouchEvent forwarding? Because there are PressEvent, MoveEvent and ReleaseEvent types which is not clear how to use when forwarding.
Should I create a new QMouseEvents orignore()existing to make them propagate? Or What is right approach?Uss case
Goal is to accept mouse events inMapListEventsRouterwhich is inherited fromQQuickItemand forward it to Map or List.
MapListEventsRouteralso controls height ofMapandList. Idea is that when scrollingListdown, firstMapheight is decreasing to 0, next the events should go directly toList.
I have reimplementedvoid mousePressEvent(QMouseEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override; void mouseMoveEvent(QMouseEvent* event) override;to achieve desired logic, but
MouseEvents do not go toMaporList. I have triedevent->ignore(),QCoreApplication::sendEvent(_list, event)but with no success. Events just do not propagate toMaporList.
What do I do wrong?// simplified code Item { id: root Map { id: aMap height: mapListRouter.mapHeight width: parent.width } ListView { id: aList height: mapListRouter.listHeight width: parent.width } MapListEventsRouter { id: mapListRouter height: parent.height width: parent.width map: aMap list: aList } }