summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/axis/q3dcategoryaxis.cpp
blob: 2090ad1c575b253be28b2401d0dfc9c579a47991 (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
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the QtDataVis3D module.
**
** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
**
****************************************************************************/

#include "q3dcategoryaxis.h"
#include "q3dcategoryaxis_p.h"

QT_DATAVIS3D_BEGIN_NAMESPACE

/*!
 * \class Q3DCategoryAxis
 * \inmodule QtDataVis3D
 * \brief The Q3DCategoryAxis class is used for manipulating an axis of a graph.
 * \since 1.0.0
 *
 * Q3DCategoryAxis provides an axis that can be given labels. The axis is divided into equal-sized
 * categories based on \l {Q3DBars::setDataWindow()}{data window} size.
 *
 * Grid lines are drawn between categories, if visible. Labels are drawn to positions of categories
 * if provided.
 */

/*!
 * Constructs Q3DCategoryAxis with \a parent.
 */
Q3DCategoryAxis::Q3DCategoryAxis(QObject *parent) :
    Q3DAbstractAxis(new Q3DCategoryAxisPrivate(this), parent)
{
}

/*!
 * Destroys Q3DCategoryAxis.
 */
Q3DCategoryAxis::~Q3DCategoryAxis()
{
}

/*!
 * \property Q3DCategoryAxis::categoryLabels
 *
 * Defines labels for axis applied to categories. If there are fewer labels than categories, the
 * remaining ones do not have a label.
 */
QStringList Q3DCategoryAxis::categoryLabels() const
{
    return labels();
}

void Q3DCategoryAxis::setCategoryLabels(const QStringList &labels)
{
    if (d_ptr->m_labels != labels) {
        d_ptr->m_labels = labels;
        emit labelsChanged();
    }
}

/*!
 * \internal
 */
Q3DCategoryAxisPrivate *Q3DCategoryAxis::dptr()
{
    return static_cast<Q3DCategoryAxisPrivate *>(d_ptr.data());
}

Q3DCategoryAxisPrivate::Q3DCategoryAxisPrivate(Q3DCategoryAxis *q)
    : Q3DAbstractAxisPrivate(q, Q3DAbstractAxis::AxisTypeCategory)
{
}

Q3DCategoryAxisPrivate::~Q3DCategoryAxisPrivate()
{
}

QT_DATAVIS3D_END_NAMESPACE