diff options
author | Mika Salmela <mika.salmela@digia.com> | 2014-08-21 09:55:23 +0300 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2014-08-21 10:09:04 +0300 |
commit | 8fab0a9cfcbed9deb47f4a9bd101434985c1c611 (patch) | |
tree | 4c884d30f6bed5ce7471a16884b734ab8a347763 /examples/datavisualization/texturesurface/surfacegraph.cpp | |
parent | 7ef676c7cbe5e3a960a66150794be3a862642073 (diff) |
Gradient to highlight series
Added a gradient to highlight series on textured surface example.
Change-Id: I2fc17dfa79f986cf5b651d964eb3bcf5d65f1c80
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/datavisualization/texturesurface/surfacegraph.cpp')
-rw-r--r-- | examples/datavisualization/texturesurface/surfacegraph.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/datavisualization/texturesurface/surfacegraph.cpp b/examples/datavisualization/texturesurface/surfacegraph.cpp index f85ef5c8..785cf576 100644 --- a/examples/datavisualization/texturesurface/surfacegraph.cpp +++ b/examples/datavisualization/texturesurface/surfacegraph.cpp @@ -22,13 +22,12 @@ #include <QtDataVisualization/QValue3DAxis> #include <QtDataVisualization/Q3DTheme> -#include <QDebug> - using namespace QtDataVisualization; const float areaWidth = 8000.0f; const float areaHeight = 8000.0f; const float aspectRatio = 0.1389f; +const float minRange = areaWidth * 0.49f; SurfaceGraph::SurfaceGraph(Q3DSurface *surface) : m_graph(surface) @@ -56,6 +55,12 @@ SurfaceGraph::SurfaceGraph(Q3DSurface *surface) m_highlight = new HighlightSeries(); m_highlight->setTopographicSeries(m_topography); + m_highlight->setMinHeight(minRange * aspectRatio); + m_highlight->handleGradientChange(areaWidth * aspectRatio); +//! [1] + QObject::connect(m_graph->axisY(), &QValue3DAxis::maxChanged, + m_highlight, &HighlightSeries::handleGradientChange); +//! [1] m_graph->addSeries(m_topography); m_graph->addSeries(m_highlight); @@ -63,7 +68,7 @@ SurfaceGraph::SurfaceGraph(Q3DSurface *surface) m_inputHandler = new CustomInputHandler(m_graph); m_inputHandler->setHighlightSeries(m_highlight); m_inputHandler->setAxes(m_graph->axisX(), m_graph->axisY(), m_graph->axisZ()); - m_inputHandler->setLimits(0.0f, areaWidth); + m_inputHandler->setLimits(0.0f, areaWidth, minRange); m_inputHandler->setAspectRatio(aspectRatio); m_graph->setActiveInputHandler(m_inputHandler); |