diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-10-08 15:35:15 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-10-09 10:09:31 +0300 |
commit | f3a73782738c5868541086eadd5e5c7b4aaabc14 (patch) | |
tree | ee078b8e1de5a93c7d067e5ade243f5c411b3b2a /src/datavisualization/engine/abstract3drenderer.cpp | |
parent | a350868f0e49b52b5bb35ba5e320a0d7dc3f698a (diff) |
Fix screen position based queries in threaded rendering environment
QtQuick's threaded renderer doesn't seem to always pair up sync and
render (or more accurately, beforeSynchronizing and node's
preprocess calls). Sometimes sync comes without a followup render,
or there are two syncs in a row, even though the sync is using
direct connection. Both of these cases broke the old
logic for handling position based queries.
Changed the logic to actually ensure we have resolved the query
before emitting the relevant signal.
Task-number: QTRD-3358
Change-Id: Ica6c8c311f53a06311c21532aaabc18c28556655
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/engine/abstract3drenderer.cpp')
-rw-r--r-- | src/datavisualization/engine/abstract3drenderer.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index a5b517fd..c47e2b29 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -53,8 +53,9 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller) m_selectionState(SelectNone), m_devicePixelRatio(1.0f), m_selectionLabelDirty(true), - m_clickPending(false), + m_clickResolved(false), m_graphPositionQueryPending(false), + m_graphPositionQueryResolved(false), m_clickedSeries(0), m_clickedType(QAbstract3DGraph::ElementNone), m_selectedLabelIndex(-1), @@ -337,10 +338,6 @@ void Abstract3DRenderer::updateScene(Q3DScene *scene) if (Q3DScene::invalidSelectionPoint() == logicalPixelPosition) { updateSelectionState(SelectNone); } else { - // Selections are one-shot, reset selection active to false before processing - scene->setSelectionQueryPosition(Q3DScene::invalidSelectionPoint()); - m_clickPending = true; - if (scene->isSlicingActive()) { if (scene->isPointInPrimarySubView(logicalPixelPosition)) updateSelectionState(SelectOnOverview); @@ -353,10 +350,14 @@ void Abstract3DRenderer::updateScene(Q3DScene *scene) } } - if (Q3DScene::invalidSelectionPoint() != logicalGraphPosition) { + if (Q3DScene::invalidSelectionPoint() != logicalGraphPosition) m_graphPositionQueryPending = true; - scene->setGraphPositionQuery(Q3DScene::invalidSelectionPoint()); - } + + // Queue up another render when we have a query that needs resolving. + // This is needed because QtQuick scene graph can sometimes do a sync without following it up + // with a render. + if (m_graphPositionQueryPending || m_selectionState != SelectNone) + emit needRender(); } void Abstract3DRenderer::updateTextures() @@ -1767,6 +1768,8 @@ void Abstract3DRenderer::queriedGraphPosition(const QMatrix4x4 &projectionViewMa m_queriedGraphPosition = QVector3D(normalizedValues.x(), normalizedValues.y(), normalizedValues.z()); + m_graphPositionQueryResolved = true; + m_graphPositionQueryPending = false; } void Abstract3DRenderer::calculatePolarXZ(const QVector3D &dataPos, float &x, float &z) const |