summaryrefslogtreecommitdiffstats
path: root/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc
blob: c3fe2e84405903d2413214b6342b0fe185c5272f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
*/