summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/q3dscene.cpp
diff options
context:
space:
mode:
authorKeränen Pasi <pasi.keranen@digia.com>2013-11-12 09:24:56 +0200
committerPasi Keränen <pasi.keranen@digia.com>2013-11-15 12:35:06 +0200
commitcc22cc40e889b5b2f0e49ce32f660395cef865b7 (patch)
tree03bb5365bbfc614cfb94ffe304e632eb16ce5493 /src/datavisualization/engine/q3dscene.cpp
parent999ffa01d20f75a457da62d41c0fabfc32e5e1bb (diff)
Changes scene to be proxy for input position and selection communication.
Change-Id: I83729508c8a0281569be5f43791d44d36d800ca2 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine/q3dscene.cpp')
-rw-r--r--src/datavisualization/engine/q3dscene.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/datavisualization/engine/q3dscene.cpp b/src/datavisualization/engine/q3dscene.cpp
index 70c8ffd6..3cda41b7 100644
--- a/src/datavisualization/engine/q3dscene.cpp
+++ b/src/datavisualization/engine/q3dscene.cpp
@@ -178,6 +178,34 @@ void Q3DScene::setSecondarySubViewport(const QRect &secondarySubViewport)
}
/*!
+ * \property Q3DScene::selectionQueryPosition
+ * This property contains the coordinates for the user input that should be processed
+ * by the scene as selection. If this is set to value other than Q3DScene()::noSelectionPoint() the
+ * graph tries to select a data item at the given \a point within the main viewport.
+ * After the rendering pass the property is returned to its default state of Q3DScene()::noSelectionPoint().
+ */
+void Q3DScene::setSelectionQueryPosition(const QPoint &point)
+{
+ if (point != d_ptr->m_selectionQueryPosition) {
+ d_ptr->m_selectionQueryPosition = point;
+ d_ptr->m_changeTracker.selectionQueryPositionChanged = true;
+ emit selectionQueryPositionChanged(point);
+ emitNeedRender();
+ }
+}
+
+QPoint Q3DScene::selectionQueryPosition() const
+{
+ return d_ptr->m_selectionQueryPosition;
+}
+
+const QPoint Q3DScene::noSelectionPoint()
+{
+ static const QPoint noSelectionPos(-1, -1);
+ return noSelectionPos;
+}
+
+/*!
* \property Q3DScene::slicingActive
*
* This property contains whether 2D slicing view is currently active or not.
@@ -329,7 +357,6 @@ void Q3DScene::setLightPositionRelativeToCamera(const QVector3D &relativePositio
* \fn Q3DScene::needRender()
* \internal
*/
-
Q3DScenePrivate::Q3DScenePrivate(Q3DScene *q) :
q_ptr(q),
m_isSecondarySubviewOnTop(true),
@@ -337,7 +364,8 @@ Q3DScenePrivate::Q3DScenePrivate(Q3DScene *q) :
m_camera(),
m_light(),
m_isUnderSideCameraEnabled(false),
- m_isSlicingActive(false)
+ m_isSlicingActive(false),
+ m_selectionQueryPosition(Q3DScene::noSelectionPoint())
{
}
@@ -371,6 +399,11 @@ void Q3DScenePrivate::sync(Q3DScenePrivate &other)
m_changeTracker.secondarySubViewportChanged = false;
other.m_changeTracker.secondarySubViewportChanged = false;
}
+ if (m_changeTracker.selectionQueryPositionChanged) {
+ other.q_ptr->setSelectionQueryPosition(q_ptr->selectionQueryPosition());
+ m_changeTracker.selectionQueryPositionChanged = false;
+ other.m_changeTracker.selectionQueryPositionChanged = false;
+ }
if (m_changeTracker.cameraChanged) {
m_camera->setDirty(true);
m_changeTracker.cameraChanged = false;