diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-08-06 12:52:34 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-08-06 13:11:16 +0300 |
commit | 1cbeea3d48a1d55f5eef0ee419d209a7a9625c3f (patch) | |
tree | e368e297efe94bce1938973bdbd6df4da6a5573d /examples/datavisualization/bars/doc | |
parent | dd99eb73740ad015a2a2d28481e5a2ca8ab1d7b1 (diff) |
Add zooming to selection to bars example
Task-number: QTRD-3262
Change-Id: I96de8d97813cc82707a9b608127464ed4d6be6f7
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/datavisualization/bars/doc')
-rw-r--r-- | examples/datavisualization/bars/doc/src/bars.qdoc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/datavisualization/bars/doc/src/bars.qdoc b/examples/datavisualization/bars/doc/src/bars.qdoc index 9717fe8a..1117376f 100644 --- a/examples/datavisualization/bars/doc/src/bars.qdoc +++ b/examples/datavisualization/bars/doc/src/bars.qdoc @@ -188,6 +188,30 @@ You can use the same method with \c SelectionSlice and \c SelectionItem flags, as long as you have either \c SelectionRow or \c SelectionColumn set as well. + \section1 Zooming to selection + + As an example of adjusting camera target we have implemented an animation of zooming to + selection via a button press. Animation initializations are done in the constructor: + + \snippet bars/graphmodifier.cpp 12 + + The function \c{GraphModifier::zoomToSelectedBar()} contains the rest of the functionality: + + \snippet bars/graphmodifier.cpp 11 + + The QPropertyAnimation \c m_animationCameraTarget targets Q3DCamera::target property, + which takes a value normalized to the range (-1, 1). We figure out where the selected bar + is relative to axes, and use that as the end value for \c{m_animationCameraTarget}: + + \snippet bars/graphmodifier.cpp 13 + \dots + \snippet bars/graphmodifier.cpp 14 + + Likewise, we want to angle the camera so that it always points approximately to the center of + the graph at the end of the animation: + + \snippet bars/graphmodifier.cpp 15 + \section1 Example contents */ |