Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.7.0
-
None
Description
When calling scenePosition() on a QWheelEvent it returns the same as position(). This is different to e.g. QMouseEvent generated from key press, release, or move events, and also against the documented behavior.
Here is what the documentation says:
The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(), in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(), or the window position in widget applications.
However it returns the local position, relative to the current widget.
I looked at the source-code and this is how the constructor of QWheelEvent looks like:
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted, Qt::MouseEventSource source, const QPointingDevice *device) : QSinglePointEvent(Wheel, device, pos, pos, globalPos, Qt::NoButton, buttons, modifiers, source), m_pixelDelta(pixelDelta), m_angleDelta(angleDelta) {...}
It passes "pos, pos,global" to QSinglePointEvent, which expects "localPos, scenePos, globalPos". So it passes pos to both local and scene positions, not good.
I think this should either be corrected, or there should be an change to the documentation that this functionality is different for this class.
I looked at the other sub-classes of QSinglePointEvent. Both QHoverEvent and QTabletEvent also looks suspicious as well.