summaryrefslogtreecommitdiffstats
path: root/examples/charts/chartsgallery/lightmarkerswidget.h
blob: 9add2b7782699c2c6900a963116d487e41f4012c (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef LIGHTMARKERSWIDGET_H
#define LIGHTMARKERSWIDGET_H

#include "contentwidget.h"

#include <QColor>
#include <QImage>

QT_FORWARD_DECLARE_CLASS(QChartView)

class LightMarkersWidget : public ContentWidget
{
    Q_OBJECT
public:
    explicit LightMarkersWidget(QWidget *parent = nullptr);

protected:
    void resizeEvent(QResizeEvent *) override;

private:
    enum class PointType {
        RedRectangle,
        GreenTriangle,
        OrangeCircle
    };

    enum class SelectedPointType {
        BlueTriangle,
        YellowRectangle,
        LavenderCircle
    };

    enum class LineColor {
        Blue,
        Black,
        Mint
    };

    QImage rectangle(qreal imageSize, const QColor &color);
    QImage circle(qreal imageSize, const QColor &color);
    QImage blueTriangle(qreal imageSize);
    QImage greenTriangle(qreal imageSize);
    QImage getPointRepresentation(PointType pointType, int imageSize);
    QImage getSelectedPointRepresentation(SelectedPointType pointType, int imageSize);
    QColor makeLineColor(LineColor lineColor);

    QWidget *m_mainWidget = nullptr;
};

#endif