diff options
author | Keränen Pasi <pasi.keranen@digia.com> | 2013-09-23 11:50:09 +0300 |
---|---|---|
committer | Pasi Keränen <pasi.keranen@digia.com> | 2013-09-23 13:08:30 +0300 |
commit | 9f8f25a8b526d636fccf70c9f782b714da865983 (patch) | |
tree | 284a56a45d61bf5e37d5f2e520597b541d6dd152 /src/datavisualization/engine/q3dscene.cpp | |
parent | 213935d072b20578f54b4c72db57344a50578a70 (diff) |
Added device pixel ratio change detection to widgets
Change-Id: I7c0677c5e6b862589150d1be8a5c5a8a0e5b4445
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine/q3dscene.cpp')
-rw-r--r-- | src/datavisualization/engine/q3dscene.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/datavisualization/engine/q3dscene.cpp b/src/datavisualization/engine/q3dscene.cpp index 53bfe480..abf41b19 100644 --- a/src/datavisualization/engine/q3dscene.cpp +++ b/src/datavisualization/engine/q3dscene.cpp @@ -242,6 +242,23 @@ void Q3DScene::setActiveLight(Q3DLight *light) } /*! + * \property Q3DScene::devicePixelRatio + * + * This property contains the current device pixel ratio that is used when mapping input + * coordinates to pixel coordinates. + */ +qreal Q3DScene::devicePixelRatio() const +{ + return d_ptr->m_devicePixelRatio; +} + +void Q3DScene::setDevicePixelRatio(qreal pixelRatio) +{ + d_ptr->m_devicePixelRatio = pixelRatio; +} + + +/*! * Calculates and sets the light position relative to the currently active camera using the given parameters. * \a relativePosition defines the relative 3D offset to the current camera position. * Optional \a fixedRotation fixes the light rotation around the data visualization area to the given value in degrees. @@ -272,6 +289,7 @@ void Q3DScene::setUnderSideCameraEnabled(bool isEnabled) Q3DScenePrivate::Q3DScenePrivate(Q3DScene *q) : q_ptr(q), + m_devicePixelRatio(1.f), m_camera(), m_light(), m_isUnderSideCameraEnabled(false), @@ -328,6 +346,12 @@ void Q3DScenePrivate::sync(Q3DScenePrivate &other) m_changeTracker.slicingActivatedChanged = false; other.m_changeTracker.slicingActivatedChanged = false; } + + if (m_changeTracker.devicePixelRatioChanged) { + other.q_ptr->setDevicePixelRatio(q_ptr->devicePixelRatio()); + m_changeTracker.devicePixelRatioChanged = false; + other.m_changeTracker.devicePixelRatioChanged = false; + } } QT_DATAVISUALIZATION_END_NAMESPACE |