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

#ifndef DYNAMICSPLINEWIDGET_H
#define DYNAMICSPLINEWIDGET_H

#include "contentwidget.h"

#include <QTimer>

QT_FORWARD_DECLARE_CLASS(QSplineSeries)
QT_FORWARD_DECLARE_CLASS(QValueAxis)

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

public slots:
    void handleTimeout();

private:
    QSplineSeries *m_series = nullptr;
    QValueAxis *m_axisX = nullptr;
    QValueAxis *m_axisY = nullptr;
    QTimer m_timer;
    QStringList m_titles;
    qreal m_step = 0.;
    qreal m_x = 5;
    qreal m_y = 1;
};

#endif