summaryrefslogtreecommitdiffstats
path: root/src/graphs2d/axis/qabstractaxis_p.h
blob: d571e0601bd377e676658ff48565bb2e09e02cec (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

//  W A R N I N G
//  -------------
//
// This file is not part of the QtGraphs API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.

#ifndef QABSTRACTAXIS_P_H
#define QABSTRACTAXIS_P_H

#include <QtGraphs/QAbstractAxis>
#include <private/qgraphsview_p.h>
#include <QtCore/QDebug>
#include <QtCore/private/qobject_p.h>
#include <QColor>

#include <memory>

QT_BEGIN_NAMESPACE

class QQmlComponent;

class QAbstractAxisPrivate : public QObjectPrivate
{
public:
    QAbstractAxisPrivate();
    ~QAbstractAxisPrivate() override;

public:
    void setGraph(QGraphsView *graph) { m_graph = graph; }

    //interface for manipulating range form base class
    virtual void setMin(const QVariant &min) = 0;
    virtual void setMax(const QVariant &max) = 0;
    virtual void setRange(const QVariant &min, const QVariant &max) = 0;

    //interface manipulating range form domain
    virtual void setRange(qreal min, qreal max) = 0;
    virtual qreal min() = 0;
    virtual qreal max() = 0;

public Q_SLOTS:
    void handleRangeChanged(qreal min, qreal max);

protected:
    QGraphsView *m_graph = nullptr;

private:
    bool m_visible = true;

    bool m_lineVisible = true;

    bool m_gridVisible = true;
    bool m_subGridVisible = true;

    bool m_labelsVisible = true;
    qreal m_labelsAngle = 0;
    QQmlComponent *m_labelDelegate = nullptr;

    bool m_titleVisible = true;
    QColor m_titleColor;
    QFont m_titleFont;
    QString m_title;

    Qt::Alignment m_alignment = Qt::AlignAbsolute;
    Qt::TextElideMode m_textElide = Qt::ElideNone;

    Q_DECLARE_PUBLIC(QAbstractAxis)
};

QT_END_NAMESPACE

#endif