diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-07-14 20:09:57 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-02-25 10:31:37 +0100 |
commit | f35afe3eeaa460cb5e96171fb8a43fdf52c8761c (patch) | |
tree | 32b5c087a30a5dc455b8505415b0372c661f24cd /src/quickwidgets/qquickwidget.cpp | |
parent | 4853b3a7d50c20ad00a2780b8d11a0f9c38462ae (diff) |
Move event delivery from QQWindow to QQuickDeliveryAgent
QQuickWindow owns QQuickRootItem which owns QQuickDeliveryAgent, so
for every window there's an object responsible for event delivery,
while the window itself is mainly responsible for rendering (separation
of concerns). However, QQuickRootItem and QQuickDeliveryAgent can now
be used in cases where the scene doesn't directly belong to a window,
such as when a Qt Quick sub-scene is mapped somewhere into a Qt Quick 3D
scene. In that case, we must remember which delivery agent was in use
at the time when a QEventPoint is grabbed and deliver subsequent updates
via the same DA. There's also a QQuickDeliveryAgent::Transform
abstraction which subscene-management code (such as QQuick3DViewport)
can implement, to provide a formula to map the window's scene
coordinates to subscene coordinates; if defined, it will be used
during delivery of subsequent updates to existing grabbers.
Task-number: QTBUG-84870
Change-Id: I70b433f7ebb05d2e60214ff3192e05da0aa84a42
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 68c103225f4e8bd6c1b18ef547108fd60f398c0f)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quickwidgets/qquickwidget.cpp')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 6951dccf62..46da85630b 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -846,9 +846,15 @@ void QQuickWidgetPrivate::updateSize() if (resizeMode == QQuickWidget::SizeViewToRootObject) { QSize newSize = QSize(root->width(), root->height()); - if (newSize.isValid() && newSize != q->size()) { - q->resize(newSize); - q->updateGeometry(); + if (newSize.isValid()) { + if (newSize != q->size()) { + q->resize(newSize); + q->updateGeometry(); + } else if (offscreenWindow->size().isEmpty()) { + // QQuickDeliveryAgentPrivate::deliverHoverEvent() ignores events that + // occur outside of QQuickRootItem's geometry, so we need it to match root's size. + offscreenWindow->contentItem()->setSize(newSize); + } } } else if (resizeMode == QQuickWidget::SizeRootObjectToView) { const bool needToUpdateWidth = !qFuzzyCompare(q->width(), root->width()); |