From a4c2f2fb8c0020c9ee9c569ef0bbf5588d87304c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 7 Dec 2021 14:47:31 +0200 Subject: [PATCH] QmlDesigner: Fix Qt5 compilation QQuick3DViewport::pickAll was introduced in Qt 6.2. Checking against version 6.2.1 because that's when the global picking API was taken into use in QmlDesigner. Change-Id: Id69ff9d958da89ba9e043dfb082a99f640884a4e Reviewed-by: Thomas Hartmann --- .../qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp index 4182dcadf1e..a4e950b238b 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/mousearea3d.cpp @@ -898,7 +898,12 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) // a problem onCircle = false; if (m_pickNode) { - // We need to pick all as various other geometries can often be the first +#if QT_VERSION < QT_VERSION_CHECK(6, 2, 1) + QQuick3DPickResult pr = m_view3D->pick(float(mousePos.x()), float(mousePos.y())); + pickSuccess = pr.objectHit() == m_pickNode; +#else + // With the introduction of global picking API, + // we need to pick all as various other geometries can often be the first // pick result, such as camera frustum or light geometry const QList results = m_view3D->pickAll(float(mousePos.x()), float(mousePos.y())); @@ -908,6 +913,7 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event) break; } } +#endif } } }