diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-08-06 12:24:37 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-08-06 12:24:37 +0200 |
commit | 6f357f50b4b72e3c5a6903a09624ade1d72d12c1 (patch) | |
tree | a7c39b76c99f4887dbc6837be3a41afc7fdb29b4 /src/widgets/graphicsview/qgraphicsview.cpp | |
parent | 7301e44161d8bb25410219a31405584c9492b83e (diff) | |
parent | 3183e428a95c95e5047dd12fbf2b6388aa7698fb (diff) |
Merge remote-tracking branch 'origin/dev' into wip/qt6
Change-Id: Ib719a6249069e6bd6c9311bbec7f364855ab82ff
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsview.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 3ec9668cde..7f14218720 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -691,7 +691,7 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event) } // Find the topmost item under the mouse with a cursor. foreach (QGraphicsItem *item, scene->d_func()->cachedItemsUnderMouse) { - if (item->hasCursor()) { + if (item->isEnabled() && item->hasCursor()) { _q_setViewportCursor(item->cursor()); return; } @@ -808,7 +808,7 @@ void QGraphicsViewPrivate::_q_unsetViewportCursor() Q_Q(QGraphicsView); const auto items = q->items(lastMouseEvent.pos()); for (QGraphicsItem *item : items) { - if (item->hasCursor()) { + if (item->isEnabled() && item->hasCursor()) { _q_setViewportCursor(item->cursor()); return; } @@ -3426,12 +3426,13 @@ void QGraphicsView::wheelEvent(QWheelEvent *event) QGraphicsSceneWheelEvent wheelEvent(QEvent::GraphicsSceneWheel); wheelEvent.setWidget(viewport()); - wheelEvent.setScenePos(mapToScene(event->pos())); - wheelEvent.setScreenPos(event->globalPos()); + wheelEvent.setScenePos(mapToScene(event->position().toPoint())); + wheelEvent.setScreenPos(event->globalPosition().toPoint()); wheelEvent.setButtons(event->buttons()); wheelEvent.setModifiers(event->modifiers()); - wheelEvent.setDelta(event->delta()); - wheelEvent.setOrientation(event->orientation()); + const bool horizontal = qAbs(event->angleDelta().x()) > qAbs(event->angleDelta().y()); + wheelEvent.setDelta(horizontal ? event->angleDelta().x() : event->angleDelta().y()); + wheelEvent.setOrientation(horizontal ? Qt::Horizontal : Qt::Vertical); wheelEvent.setAccepted(false); QCoreApplication::sendEvent(d->scene, &wheelEvent); event->setAccepted(wheelEvent.isAccepted()); |