Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

from widgets to quick2

$
0
0
Sorry for the confusion. My response was to this problem: That would be a good future step. But right now I am blocked because I cannot get simple mouse events to propagate to my handling class (below). If you call setAcceptedMouseButtons() in the constructor of ViewportWidget the signal handler in ViewportWidget should be called. That worked for me. Then you don’t need any MouseArea nor do you need to declare Q_INVOKABLE for the mousePressEvent(). All you need then in QML is: ViewportWidget {     id: viewportwidget     width: 600; height: 600 On the other hand if you want to handle it with a MouseArea and forward the events, that is possible too. However you can’t forward the ‘mouse’ parameter as it is of type QQuickMouseEvent* and your mousePressEvent() handler needs QMouseEvent*. You could forward mouse.x and mouse.y to a Q_INVOKABLE that takes two int parameters for example.

Viewing all articles
Browse latest Browse all 4972

Trending Articles