summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/bars/doc/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-02-13 09:59:52 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-02-13 10:09:17 +0200
commit88cd10aa7b3559b092cf5575b0a17d002dc100ae (patch)
tree9d6e7efdec49419558bb4ef4a9bc02ae3cb1cfc4 /examples/datavisualization/bars/doc/src
parentecabd51692b476567dc42a745f51996ec665b385 (diff)
Fix examples installation
Had to add one folder to the examples structure so installation works correctly. Change-Id: Ic92dfe9997413a6243abcf5eeba12744ba9e938c Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/datavisualization/bars/doc/src')
-rw-r--r--examples/datavisualization/bars/doc/src/bars.qdoc172
1 files changed, 172 insertions, 0 deletions
diff --git a/examples/datavisualization/bars/doc/src/bars.qdoc b/examples/datavisualization/bars/doc/src/bars.qdoc
new file mode 100644
index 00000000..3cfc72b1
--- /dev/null
+++ b/examples/datavisualization/bars/doc/src/bars.qdoc
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtDataVisualization module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \example bars
+ \title Bars Example
+ \ingroup qtdatavisualization_examples
+ \brief Using Q3DBars in a widget application.
+
+ The bars example shows how to make a 3D bar graph using Q3DBars and combining the use of
+ widgets for adjusting several adjustable qualities. The example shows how to:
+
+ \list
+ \li Create an application with Q3DBars and some widgets
+ \li Use QBar3DSeries and QBarDataProxy to set data to the graph
+ \li Adjust some graph and series properties using widget controls
+ \endlist
+
+ It also demonstrates how having negative bar values affects the graph.
+
+ For instructions about how to interact with the graph, see \l{Qt Data Visualization Interacting with Data}{this page}.
+
+ \image bars-example.png
+
+ \section1 Creating the application
+
+ First, in main.cpp, we create a QApplication, instantiate Q3DBars and a window container
+ for it:
+
+ \snippet ../examples/bars/main.cpp 0
+
+ The call to QWidget::createWindowContainer is required, as all data visualization types
+ (Q3DBars, Q3DScatter, Q3DSurface) inherit QWindow. Any class inheriting QWindow cannot be used
+ as a widget any other way.
+
+ Then we'll create horizontal and vertical layouts. We'll add the graph and the vertical
+ layout into the horizontal one:
+
+ \snippet ../examples/bars/main.cpp 1
+
+ We're not using the vertical layout for anything yet, but we'll get back to it in
+ \l {Using widgets to control the graph}
+
+ Next, let's create another class to handle the data addition and other interaction with the
+ graph. Let's call it \c GraphModifier (See \l {Setting up the graph} and
+ \l {Adding data to the graph} for details):
+
+ \snippet ../examples/bars/main.cpp 2
+
+ The application main is done and we can show the graph and start the event loop:
+
+ \snippet ../examples/bars/main.cpp 3
+
+ \section1 Setting up the graph
+
+ Let's set up the graph in the constructor of the \c GraphModifier class we instantiated in the
+ application main:
+
+ \snippet ../examples/bars/graphmodifier.cpp 0
+
+ Let's take a closer look at parts of the code.
+
+ First we're creating the axes and the series into member variables to support changing them
+ easily later on, if we want to:
+
+ \snippet ../examples/bars/graphmodifier.cpp 1
+
+ Then we're setting some of the visual qualities for the graph:
+
+ \snippet ../examples/bars/graphmodifier.cpp 2
+
+ We're also setting up the axes and setting them to the graph as active axes:
+
+ \snippet ../examples/bars/graphmodifier.cpp 3
+
+ Next we initialize the visual properties of the series.
+ Note that the second series is initially not visible:
+
+ \snippet ../examples/bars/graphmodifier.cpp 8
+
+ The series need to be added to the graph to show them:
+
+ \snippet ../examples/bars/graphmodifier.cpp 4
+
+ Finally, we set the camera angle by calling the same method the camera angle change button
+ in the UI uses to cycle through various camera angles:
+
+ \snippet ../examples/bars/graphmodifier.cpp 6
+
+ There you can see that the camera is controlled via the scene object of the graph:
+
+ \snippet ../examples/bars/graphmodifier.cpp 10
+
+ For more information about using scene and cameras, see Q3DScene and Q3DCamera.
+
+ That concludes setting up the graph.
+
+ \section1 Adding data to the graph
+
+ At the end of the constructor there's a call:
+
+ \snippet ../examples/bars/graphmodifier.cpp 9
+
+ This method is used to add data to the proxies of the two series:
+
+ \snippet ../examples/bars/graphmodifier.cpp 5
+
+ Now the series have data to show.
+
+ \section1 Using widgets to control the graph
+
+ There isn't much interaction yet, so let's continue by adding some widgets back in the
+ application main. Let's just focus on two as an example:
+
+ \snippet ../examples/bars/main.cpp 4
+
+ We can use these slider widgets to rotate the graph instead of just using the mouse or
+ touch.
+
+ Let's add them to the vertical layout we created earlier:
+
+ \snippet ../examples/bars/main.cpp 5
+
+ Then we'll connect them to methods in \c GraphModifier:
+
+ \snippet ../examples/bars/main.cpp 6
+
+ Here are the methods in \c GraphModifier the signals were connected to. The camera
+ is controlled via the scene object. This time we specify the actual camera position
+ along the orbit around the center point, instead of specifying a preset camera angle:
+
+ \snippet ../examples/bars/graphmodifier.cpp 7
+
+ Now these two sliders can be used to rotate the graph.
+
+ And so we have an application in which we can control:
+
+ \list
+ \li Graph rotation
+ \li Label style
+ \li Camera preset
+ \li Background visibility
+ \li Grid visibility
+ \li Bar shading smoothness
+ \li Visibility of the second bar series
+ \li Data range to be shown
+ \li Bar style
+ \li Selection mode
+ \li Theme
+ \li Shadow quality
+ \li Font
+ \li Font size
+ \endlist
+
+ \section1 Example contents
+
+*/