From 5b8b37ebe42f9fb3cdc0bb269146c18ebbd56ed3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 26 Sep 2014 13:41:31 +0300 Subject: Allow setting bounds for camera zoom level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-3337 Change-Id: I503dc4402907a2fdfa74ca86698b0e98a23b3b08 Reviewed-by: Tomi Korpipää --- examples/datavisualization/volumetric/volumetric.cpp | 12 ++---------- examples/datavisualization/volumetric/volumetric.h | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'examples/datavisualization') 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(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); -- cgit v1.2.3