diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-10-24 08:47:00 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-10-24 08:50:35 +0300 |
commit | 24e79858946808da060fb1cb3088f554d82d4984 (patch) | |
tree | fa941e4eb5e31b962c9017617074fba01c364295 /src/datavisualization/engine | |
parent | 597f70bd734eb87df9219dd7a579f71c6b8bb5b0 (diff) |
Bars autoscaling fixed
Task-number: QTRD-2503
Change-Id: Ib4f621d33411168343540a51a505b4ece1679f77
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine')
-rw-r--r-- | src/datavisualization/engine/bars3drenderer.cpp | 11 | ||||
-rw-r--r-- | src/datavisualization/engine/q3dbars.cpp | 1 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index d4cb23d6..c7c2f64c 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -84,7 +84,7 @@ Bars3DRenderer::Bars3DRenderer(Bars3DController *controller) m_scaleX(0), m_scaleZ(0), m_scaleFactor(0), - m_maxSceneSize(40.0), + m_maxSceneSize(40.0f), m_selection(selectionSkipColor), m_previousSelection(selectionSkipColor), m_hasHeightAdjustmentChanged(true) @@ -169,10 +169,11 @@ void Bars3DRenderer::updateDataModel(QBarDataProxy *dataProxy) m_sliceSelection->clear(); m_cachedColumnCount = newColumns; - m_cachedRowCount = newRows; - // TODO: Invent foolproof max scene size formula - // This seems to work ok if spacing is not negative (and row/column or column/row ratio is not too high) - m_maxSceneSize = 2 * qSqrt(newColumns * newRows); + m_cachedRowCount = newRows; + // Calculate max scene size + GLfloat sceneRatio = qMin(GLfloat(newColumns) / GLfloat(newRows), + GLfloat(newRows) / GLfloat(newColumns)); + m_maxSceneSize = 2.0f * qSqrt(sceneRatio * newColumns * newRows); // Calculate here and at setting bar specs calculateSceneScalingFactors(); } diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp index ba4f03ae..bc2ffeba 100644 --- a/src/datavisualization/engine/q3dbars.cpp +++ b/src/datavisualization/engine/q3dbars.cpp @@ -608,7 +608,6 @@ Q3DBarsPrivate::Q3DBarsPrivate(Q3DBars *q, QRect rect) Q3DBarsPrivate::~Q3DBarsPrivate() { - qDebug() << "Destroying Q3DBarsPrivate"; delete m_shared; } |