From 8fab0a9cfcbed9deb47f4a9bd101434985c1c611 Mon Sep 17 00:00:00 2001 From: Mika Salmela Date: Thu, 21 Aug 2014 09:55:23 +0300 Subject: Gradient to highlight series MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a gradient to highlight series on textured surface example. Change-Id: I2fc17dfa79f986cf5b651d964eb3bcf5d65f1c80 Reviewed-by: Tomi Korpipää --- examples/datavisualization/texturesurface/surfacegraph.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'examples/datavisualization/texturesurface/surfacegraph.cpp') 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 #include -#include - 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); -- cgit v1.2.3