diff options
author | Andrii Staikov <andrii.staikov@scythe-studio.com> | 2021-07-02 16:56:36 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-24 11:16:10 +0000 |
commit | d8bb227290f2f464e239a0b2c93290c50278ba90 (patch) | |
tree | 10be12508112aee1e203a6e8ed5f946ef9170ff7 /src | |
parent | e942e61b39b2988129ade944179a0c2c1bcdd6f0 (diff) |
Add spline-series example
Example shows using of points selection and adding light markers to plot.
User can select shapes for markers and light markers and set images for them.
[QtCharts][Example] Added Example
Task-number: QTBUG-89445
Task-number: QTBUG-92884
Change-Id: Id0c9a5a7b696b7a51804575f645578d06c717d4e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
(cherry picked from commit 5070d1fc3ee4b63c8a04f1fdf9226b779a6cb167)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/charts/doc/images/examples_pointsselectionandmarkers1.png | bin | 0 -> 18597 bytes | |||
-rw-r--r-- | src/charts/doc/images/examples_pointsselectionandmarkers2.png | bin | 0 -> 18545 bytes | |||
-rw-r--r-- | src/charts/doc/src/examples-pointsselectionandmarkers.qdoc | 76 |
3 files changed, 76 insertions, 0 deletions
diff --git a/src/charts/doc/images/examples_pointsselectionandmarkers1.png b/src/charts/doc/images/examples_pointsselectionandmarkers1.png Binary files differnew file mode 100644 index 00000000..7a98ddea --- /dev/null +++ b/src/charts/doc/images/examples_pointsselectionandmarkers1.png diff --git a/src/charts/doc/images/examples_pointsselectionandmarkers2.png b/src/charts/doc/images/examples_pointsselectionandmarkers2.png Binary files differnew file mode 100644 index 00000000..8b8b0800 --- /dev/null +++ b/src/charts/doc/images/examples_pointsselectionandmarkers2.png diff --git a/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc b/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc new file mode 100644 index 00000000..c3fe2e84 --- /dev/null +++ b/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example pointsselectionandmarkers + \title Light Markers Points Selection Example + \ingroup qtcharts_examples + + \brief The example shows a usage of light markers + and points selection for the series. + + \image examples_pointsselectionandmarkers1.png + \image examples_pointsselectionandmarkers2.png + + \include examples-run.qdocinc + + \section1 Light Markers Feature + + We start with creating a series, filling it with the data, and setting up selection funcionality. + It's important not to set points visibility to \c true, because light markers functionality is + an independent feature and setting both would result in undesired behavior. + \snippet pointsselectionandmarkers/main.cpp 1 + + Then we create the \c {QChart}, the \c {QChartview} and the control widget with its layout to arrange customization elements. + \snippet pointsselectionandmarkers/main.cpp 2 + + The next step is creating elements of customization. + \snippet pointsselectionandmarkers/main.cpp 3 + + We create the label for the marker selection combobox and add fill the combobox with the items. + Also, we provide functionality to the combobox. Considering the implementation of the light markers + functionality, we need to make sure if displaying of unselected points is checked. + Switching the visibility of the light marker off is achieved by setting it to \c "empty" \c {QImage}. + If the user unchecks the displaying of unselected points and changes the light marker image, unselected points + have to remain invisible. + If checking isn't performed, new \c {QImage} will be set for light marker + and unselected points will be visible even though it has been switched off. + \snippet pointsselectionandmarkers/main.cpp 4 + + Almost the same procedure applies to the selected point light marker and line color. The only difference is + that there's no need to check visibility of unselected points as it doesn't affect the functionality. + \snippet pointsselectionandmarkers/main.cpp 5 + + A small difference comes with changing visibility of unselected points. As it was mentioned before, + making light markers invisible is achieved by setting them to "empty" \c {QImage}. + That is why, depending on checkbox state, selected point light marker is set to "empty" \c {QImage} or + to the light marker extracted from the current index of the corresponding combobox. + \snippet pointsselectionandmarkers/main.cpp 6 + + The final part is to arrange the elements, add all the widgets to the main widget, and set the main window size. + \snippet pointsselectionandmarkers/main.cpp 7 +*/ |