summaryrefslogtreecommitdiffstats
path: root/src/charts/candlestickchart/qcandlestickset.h
blob: 237d7bb4257df18a3baa23a8566b80a1f83478e0 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:COMM$
**
** 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.
**
** $QT_END_LICENSE$
**
**
**
**
**
**
**
**
**
****************************************************************************/

#ifndef QCANDLESTICKSET_H
#define QCANDLESTICKSET_H

#include <QtCharts/QChartGlobal>
#include <QtGui/QBrush>
#include <QtGui/QPen>

QT_CHARTS_BEGIN_NAMESPACE

class QCandlestickSetPrivate;

class Q_CHARTS_EXPORT QCandlestickSet : public QObject
{
    Q_OBJECT
    Q_PROPERTY(qreal timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
    Q_PROPERTY(qreal open READ open WRITE setOpen NOTIFY openChanged)
    Q_PROPERTY(qreal high READ high WRITE setHigh NOTIFY highChanged)
    Q_PROPERTY(qreal low READ low WRITE setLow NOTIFY lowChanged)
    Q_PROPERTY(qreal close READ close WRITE setClose NOTIFY closeChanged)
    Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
    Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)

public:
    explicit QCandlestickSet(qreal timestamp = 0.0, QObject *parent = nullptr);
    explicit QCandlestickSet(qreal open, qreal high, qreal low, qreal close, qreal timestamp = 0.0,
                             QObject *parent = nullptr);
    virtual ~QCandlestickSet();

    void setTimestamp(qreal timestamp);
    qreal timestamp() const;

    void setOpen(qreal open);
    qreal open() const;

    void setHigh(qreal high);
    qreal high() const;

    void setLow(qreal low);
    qreal low() const;

    void setClose(qreal close);
    qreal close() const;

    void setBrush(const QBrush &brush);
    QBrush brush() const;

    void setPen(const QPen &pen);
    QPen pen() const;

Q_SIGNALS:
    void clicked();
    void hovered(bool status);
    void pressed();
    void released();
    void doubleClicked();
    void timestampChanged();
    void openChanged();
    void highChanged();
    void lowChanged();
    void closeChanged();
    void brushChanged();
    void penChanged();

private:
    QScopedPointer<QCandlestickSetPrivate> d_ptr;
    Q_DECLARE_PRIVATE(QCandlestickSet)
    Q_DISABLE_COPY(QCandlestickSet)
    friend class QCandlestickSeriesPrivate;
};

QT_CHARTS_END_NAMESPACE

#endif // QCANDLESTICKSET_H