Mouse events on QQuickPaintedItem
Unsolved
QML and Qt Quick
-
My class is derived from QQUickPaintedItem:
Chart::Chart(QQuickItem *parent) : QQuickPaintedItem(parent) { setAcceptedMouseButtons(Qt::AllButtons); }
It implements mouse event functions:
void Chart::mousePressEvent(QMouseEvent *event) { event->accept(); QPointF pos = event->localPos(); qDebug() << "mousePressEvent" << pos.x() << pos.y(); } void Chart::mouseReleaseEvent(QMouseEvent *event) { event->accept(); QPointF pos = event->localPos(); qDebug() << "mouseReleaseEvent" << pos.x() << pos.y(); } void Chart::mouseMoveEvent(QMouseEvent *event) { event->accept(); QPointF pos = event->localPos(); qDebug() << "mouseMoveEvent" << pos.x() << pos.y(); } void Chart::wheelEvent(QWheelEvent *event) { event->accept(); qDebug() << "wheelEvent" << event->angleDelta(); }
The QML part:
Chart { width: 100; height: 100 }
I get mouser press events, mouse move events when mouse button is pressed and I get no mouse release events and no wheel events
How to get mouse move events even when no mouse button is pressed and how to get mouse release events and wheel events?