summaryrefslogtreecommitdiffstats
path: root/examples/scatter
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2013-12-12 14:31:58 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2013-12-13 08:28:38 +0200
commitc919f54984e9c4925a0c02b21f0e10b3dde64e60 (patch)
tree596331429b69f5dd5fe57188baf7a1c299fbc49a /examples/scatter
parent132502c16e8ccb6d6fc627e2b5f6f89838d88c8e (diff)
Fix scatter and surface example documentations
Task-number: QTRD-2635 Change-Id: Ic37b1233e9f3219880f8bdb84efa54b4ee6383bc Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples/scatter')
-rw-r--r--examples/scatter/doc/src/scatter.qdoc23
-rw-r--r--examples/scatter/main.cpp1
-rw-r--r--examples/scatter/scatterdatamodifier.cpp14
3 files changed, 14 insertions, 24 deletions
diff --git a/examples/scatter/doc/src/scatter.qdoc b/examples/scatter/doc/src/scatter.qdoc
index 2016a052..173ea6e3 100644
--- a/examples/scatter/doc/src/scatter.qdoc
+++ b/examples/scatter/doc/src/scatter.qdoc
@@ -38,13 +38,13 @@
\section1 Creating the application
- First, in main.cpp, we create a QApplication, instantiate Q3DScatter and a window container
+ First, in main.cpp, we create a QApplication, instantiate Q3DScatter, and a window container
for it:
\snippet ../examples/scatter/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
+ (Q3DBars, Q3DScatter, and 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
@@ -56,7 +56,7 @@
\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 ScatterDataModifier (See \l {Setting up the graph} and
+ graph. Let's call it \c ScatterDataModifier (See \l {Setting up the graph} and
\l {Adding data to the graph} for details):
\snippet ../examples/scatter/main.cpp 2
@@ -67,7 +67,7 @@
\section1 Setting up the graph
- Let's set up some visual qualities for the graph in the constructor of the ScatterDataModifier
+ Let's set up some visual qualities for the graph in the constructor of the \c ScatterDataModifier
class we instantiated in the application main:
\snippet ../examples/scatter/scatterdatamodifier.cpp 0
@@ -79,8 +79,8 @@
\snippet ../examples/scatter/scatterdatamodifier.cpp 1
- And finally we create a QScatterDataProxy, set a label format for it and set it as the active
- proxy for the graph:
+ And finally we create a QScatterDataProxy and the associated QScatter3DSeries. We set custom label format
+ for the series and add it to the graph:
\snippet ../examples/scatter/scatterdatamodifier.cpp 2
@@ -88,21 +88,16 @@
\section1 Adding data to the graph
- In application main, we called \c {modifier->start()} after constructing all the necessary
- objects. This is how it looks like:
+ The last thing we do in the \c ScatterDataModifier constructor is to add data to the graph:
\snippet ../examples/scatter/scatterdatamodifier.cpp 3
- There is nothing in it except a call to another method. There is actually no need for a
- separate \c start() method, but we keep it here in case we want to add some more functionality
- in it that can be done only after all construction in application main is done.
-
The actual data addition is done in \c addData() method. First we configure the axes we created
in constructor:
\snippet ../examples/scatter/scatterdatamodifier.cpp 4
- This could have been done in the ScatterDataModifier's constructor, but we added it here
+ This could have been done in the constructor of \c {ScatterDataModifier}, but we added it here
to keep the constructor simpler and the axes configuration near the data.
Next we create a data array:
@@ -149,7 +144,7 @@
\li Dot style
\li Theme
\li Shadow quality
- \li Font
+ \li Label font
\endlist
\section1 Example contents
diff --git a/examples/scatter/main.cpp b/examples/scatter/main.cpp
index d981620c..af95dd05 100644
--- a/examples/scatter/main.cpp
+++ b/examples/scatter/main.cpp
@@ -165,7 +165,6 @@ int main(int argc, char **argv)
//! [3]
widget->show();
- modifier->start();
return app.exec();
//! [3]
}
diff --git a/examples/scatter/scatterdatamodifier.cpp b/examples/scatter/scatterdatamodifier.cpp
index 0e4bfabb..ade4eb59 100644
--- a/examples/scatter/scatterdatamodifier.cpp
+++ b/examples/scatter/scatterdatamodifier.cpp
@@ -57,9 +57,12 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
QScatterDataProxy *proxy = new QScatterDataProxy;
QScatter3DSeries *series = new QScatter3DSeries(proxy);
series->setItemLabelFormat("@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel");
- series->setMesh(QAbstract3DSeries::MeshSphere);
m_graph->addSeries(series);
//! [2]
+
+ //! [3]
+ addData();
+ //! [3]
}
ScatterDataModifier::~ScatterDataModifier()
@@ -67,17 +70,10 @@ ScatterDataModifier::~ScatterDataModifier()
delete m_graph;
}
-//! [3]
-void ScatterDataModifier::start()
-{
- addData();
-}
-//! [3]
-
void ScatterDataModifier::addData()
{
+ // Configure the axes according to the data
//! [4]
- // Add labels
m_graph->axisX()->setTitle("X");
m_graph->axisY()->setTitle("Y");
m_graph->axisZ()->setTitle("Z");