diff options
author | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2018-06-28 07:45:10 +0200 |
---|---|---|
committer | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2018-07-02 19:57:59 +0000 |
commit | 85df7a646759b6504de463692e144016a47e183e (patch) | |
tree | 1c850cfbe414aec64329ca979bf4c88e373dac88 | |
parent | 3b0ab3f12fe49e81d590b41254ece4f18c83bd1a (diff) |
Doc: Move the literal code block to the snippet file
In addition:
- added conditional exclusion of the project file-related
information and
- Updated the snippet to use append function instead of add.
Change-Id: I55d4ad3b2664d77e24b076c2c09c44b20532204c
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/charts/doc/snippets/doc_src_qtcharts.cpp | 9 | ||||
-rw-r--r-- | src/charts/doc/src/index.qdoc | 6 | ||||
-rw-r--r-- | src/charts/doc/src/qtcharts.qdoc | 27 |
3 files changed, 32 insertions, 10 deletions
diff --git a/src/charts/doc/snippets/doc_src_qtcharts.cpp b/src/charts/doc/snippets/doc_src_qtcharts.cpp index 364cc0ae..e97641a2 100644 --- a/src/charts/doc/snippets/doc_src_qtcharts.cpp +++ b/src/charts/doc/snippets/doc_src_qtcharts.cpp @@ -44,3 +44,12 @@ qmake make ./qmlpolarchart //! [2] + +//! [3] +QLineSeries* series = new QLineSeries(); +series->append(0, 6); +series->append(2, 4); +... +chartView->chart()->addSeries(series); +chartView->chart()->createDefaultAxes(); +//! [3] diff --git a/src/charts/doc/src/index.qdoc b/src/charts/doc/src/index.qdoc index e193848d..5674f541 100644 --- a/src/charts/doc/src/index.qdoc +++ b/src/charts/doc/src/index.qdoc @@ -45,8 +45,9 @@ \snippet doc_src_qtcharts.cpp 0 - \note Since Qt Creator 3.0, projects created with Qt Quick Application - wizard based on the Qt Quick 2 template uses QGuiApplication by default. + \if !defined(qtforpython) + \note Projects created with Qt Creator's Qt Quick Application + wizard are based on the Qt Quick 2 template that uses QGuiApplication by default. All such QGuiApplication instances in the project must be replaced with QApplication as the module depends on Qt's \l{Graphics View Framework} for rendering. @@ -54,6 +55,7 @@ To link against the Qt Charts module, add this line to your \c qmake project file: \snippet doc_src_qtcharts.pro 0 + \endif \section1 Licenses diff --git a/src/charts/doc/src/qtcharts.qdoc b/src/charts/doc/src/qtcharts.qdoc index e49edc3b..60144016 100644 --- a/src/charts/doc/src/qtcharts.qdoc +++ b/src/charts/doc/src/qtcharts.qdoc @@ -35,16 +35,27 @@ Charts API is built on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using the QChart class. However there is also the convenience class QChartView, which is QWidget based. These enable us to quickly use Qt Charts as a normal Qt widget. + If you intend to use Qt Charts C++ classes in your application, use the + following include and using directives: + + \snippet doc_src_qtcharts.cpp 0 + + \if !defined(qtforpython) + \note Projects created with Qt Creator's Qt Quick Application + wizard are based on the Qt Quick 2 template that uses QGuiApplication by default. + All such QGuiApplication instances in the project must be replaced with + QApplication as the module depends on Qt's \l{Graphics View Framework} + for rendering. + + To link against the Qt Charts module, add this line to your \c qmake project file: + + \snippet doc_src_qtcharts.pro 0 + \endif + Each chart type is represented by the QAbstractSeries derived class. To create charts, the users have to use an instance of the related series class and add it to a QChart instance. - \code - QLineSeries* series = new QLineSeries(); - series->add(0, 6); - series->add(2, 4); - ... - chartView->chart()->addSeries(series); - chartView->chart()->createDefaultAxes(); - \endcode + + \snippet doc_src_qtcharts.cpp 3 */ /*! |