diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-10-04 14:33:42 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-10-04 15:37:40 +0300 |
commit | b9b72df8bc8fd7078622661a6576c52627c1b327 (patch) | |
tree | cb3bc5f86d4ee5da14920daf0f23663bd045f540 /src/datavisualization | |
parent | af85378b6361d3252d00c5eaea679d031759a2d2 (diff) |
Added getting started documentation.
+Improved example stubs to allow easier listing of them
+Misc fixes
Change-Id: Ib38f63f68a376fd475442d49b525e6b2109733a4
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavisualization')
5 files changed, 79 insertions, 16 deletions
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp b/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp index 17abfd46..a5615601 100644 --- a/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp +++ b/src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp @@ -25,8 +25,10 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - //! [0] + //! [4] Q3DBars *bars = new Q3DBars(); + //! [4] + //! [0] bars->rowAxis()->setRange(0, 4); bars->columnAxis()->setRange(0, 4); //! [0] diff --git a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp index 54f64ef0..b64755e1 100644 --- a/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp +++ b/src/datavisualization/doc/snippets/doc_src_qtdatavisualization.cpp @@ -18,6 +18,8 @@ //! [0] #include <QtDataVisualization> + +using namespace QtDataVisualization; //! [0] //! [1] @@ -76,3 +78,24 @@ QItemModelSurfaceDataMapping *mapping = new QItemModelSurfaceDataMapping(QString QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy(customModel, mapping); //! [5] + +//! [6] +qmake +make +//! [6] + +//! [7] +qmake CONFIG+=static +make +//! [7] + +//! [8] +qmake +make +./qmlsurface +//! [8] + +//! [9] +Q3DBars *graph = new Q3DBars(); +QWidget *container = QWidget::createWindowContainer(graph); +//! [9] diff --git a/src/datavisualization/doc/src/qtdatavisualization-index.qdoc b/src/datavisualization/doc/src/qtdatavisualization-index.qdoc index 7ec90eaa..f2245c12 100644 --- a/src/datavisualization/doc/src/qtdatavisualization-index.qdoc +++ b/src/datavisualization/doc/src/qtdatavisualization-index.qdoc @@ -46,7 +46,7 @@ \snippet doc_src_qmldatavisualization.cpp 0 If you intend to use Qt Data Visualization C++ classes in your application, use the - following directive: + following include and using directives: \snippet doc_src_qtdatavisualization.cpp 0 @@ -74,15 +74,5 @@ Qt Data Visualization comes with the following examples: - \list - \li \l{Bars Example} - \li \l{Qt Quick 2 Bars Example} - \li \l{Qt Quick 2 Scatter Example} - \li \l{Qt Quick 2 Surface Example} - \li \l{Rainfall Example} - \li \l{Scatter Example} - \li \l{Surface Example} - \li \l{Audiolevels Example} - \li \l{Widget Example} - \endlist + \annotatedlist qtdatavisualization_examples */ diff --git a/src/datavisualization/doc/src/qtdatavisualization.qdoc b/src/datavisualization/doc/src/qtdatavisualization.qdoc index c0e317d0..ba158d27 100644 --- a/src/datavisualization/doc/src/qtdatavisualization.qdoc +++ b/src/datavisualization/doc/src/qtdatavisualization.qdoc @@ -41,11 +41,55 @@ \section1 Building Qt Data Visualization - TODO + To build Qt Data Visualization module, set up a command prompt with an environment for + building Qt applications, navigate to the directory containing \c qtdatavisualization.pro, + and give the following commands: + + \snippet doc_src_qtdatavisualization.cpp 6 + + \note The \c make tool name may vary depending on your target platform. + E.g. make/nmake/mingw32-make/... + + To build a statically linked version of the Qt Data Visualization module, give the following + commands: + + \snippet doc_src_qtdatavisualization.cpp 7 + + \section1 Running examples + + Qt Data Visualization examples are found under \c examples subdirectory. To build and run a + single example, e.g. the qmlsurface example, navigate to the example directory and give the + following commands: + + \snippet doc_src_qtdatavisualization.cpp 8 + + \note On some platforms, such as Windows, the executable can be generated under debug or + release folders, depending on your build. \section1 Creating a simple application - TODO + To create a simple application, start by creating a new Qt Gui Application project in Qt + Creator and add this line to the \c .pro file of the project: + + \snippet doc_src_qtdatavisualization.pro 0 + + In the \c main.cpp file, include the module headers and declare namespace usage: + + \snippet doc_src_qtdatavisualization.cpp 0 + + Then, add the sample code found in one of the following pages, depending on what kind of + visualization you are interested in: \l{How to construct a minimal Q3DBars graph}, + \l{How to construct a minimal Q3DScatter graph}, or + \l{How to construct a minimal Q3DSurface graph}. + + To use Qt Data Visualization graphs in widget based applications, you can use + QWidget::createWindowContainer() function to wrap the graph into a widget: + + \snippet doc_src_qtdatavisualization.cpp 9 + + For further code examples, see one of the Qt Data Visualization examples: + + \annotatedlist qtdatavisualization_examples */ /*! diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp index 660b046b..ef0eb88b 100644 --- a/src/datavisualization/engine/q3dbars.cpp +++ b/src/datavisualization/engine/q3dbars.cpp @@ -54,6 +54,10 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * * \section1 How to construct a minimal Q3DBars graph * + * First, construct an instance of Q3DBars: + * + * \snippet doc_src_q3dbars_construction.cpp 4 + * * After constructing Q3DBars, you can set the data window by changing the range on the row and * column axes. It is not mandatory, as data window will default to showing all of the data in * the data proxy. If the amount of data is large, it is usually preferable to show just a @@ -66,7 +70,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * * \snippet doc_src_q3dbars_construction.cpp 1 * - * \note We set the sample space to 5 x 5, but we are inserting only one row of data. This is ok, + * \note We set the data window to 5 x 5, but we are inserting only one row of data. This is ok, * the rest of the rows will just be blank. * * Finally you will need to set it visible: |