diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-09-26 13:41:31 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-09-26 14:15:51 +0300 |
commit | 5b8b37ebe42f9fb3cdc0bb269146c18ebbd56ed3 (patch) | |
tree | ee7e1ae9add63d37904de843df5741ce943052ae /examples | |
parent | 23717be4663a087d4d906da3e7c2c751dc2e07d5 (diff) |
Allow setting bounds for camera zoom level
Task-number: QTRD-3337
Change-Id: I503dc4402907a2fdfa74ca86698b0e98a23b3b08
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/datavisualization/volumetric/volumetric.cpp | 12 | ||||
-rw-r--r-- | examples/datavisualization/volumetric/volumetric.h | 1 |
2 files changed, 2 insertions, 11 deletions
diff --git a/examples/datavisualization/volumetric/volumetric.cpp b/examples/datavisualization/volumetric/volumetric.cpp index 65599c31..ade74fb2 100644 --- a/examples/datavisualization/volumetric/volumetric.cpp +++ b/examples/datavisualization/volumetric/volumetric.cpp @@ -87,8 +87,9 @@ VolumetricModifier::VolumetricModifier(Q3DScatter *scatter) //! [6] m_graph->activeTheme()->setBackgroundEnabled(false); - // Only allow zooming at the center to avoid clipping issues + // Only allow zooming at the center and limit the zoom to 200% to avoid clipping issues static_cast<Q3DInputHandler *>(m_graph->activeInputHandler())->setZoomAtTargetEnabled(false); + m_graph->scene()->activeCamera()->setMaxZoomLevel(200.0f); toggleAreaAll(true); @@ -204,8 +205,6 @@ VolumetricModifier::VolumetricModifier(Q3DScatter *scatter) m_graph->addCustomItem(warningLabel); #endif - QObject::connect(m_graph->scene()->activeCamera(), &Q3DCamera::zoomLevelChanged, this, - &VolumetricModifier::handleZoomLevelChange); QObject::connect(m_graph, &QAbstract3DGraph::currentFpsChanged, this, &VolumetricModifier::handleFpsChange); QObject::connect(&m_timer, &QTimer::timeout, this, @@ -310,13 +309,6 @@ void VolumetricModifier::adjustSliceZ(int value) } } -void VolumetricModifier::handleZoomLevelChange() -{ - // Zooming inside volumetric object causes ugly clipping issues, so restrict zoom level a bit - if (m_graph->scene()->activeCamera()->zoomLevel() > 200) - m_graph->scene()->activeCamera()->setZoomLevel(200); -} - void VolumetricModifier::handleFpsChange(qreal fps) { const QString fpsFormat = QStringLiteral("FPS: %1"); diff --git a/examples/datavisualization/volumetric/volumetric.h b/examples/datavisualization/volumetric/volumetric.h index 7a4e7179..8d28b524 100644 --- a/examples/datavisualization/volumetric/volumetric.h +++ b/examples/datavisualization/volumetric/volumetric.h @@ -50,7 +50,6 @@ public slots: void adjustSliceX(int value); void adjustSliceY(int value); void adjustSliceZ(int value); - void handleZoomLevelChange(); void handleFpsChange(qreal fps); void handleTimeout(); void toggleLowDetail(bool enabled); |