1 | // Copyright (C) 2017 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qbardataitem_p.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | /*! |
9 | * \class QBarDataItem |
10 | * \inmodule QtDataVisualization |
11 | * \brief The QBarDataItem class provides a container for resolved data to be added to bar graphs. |
12 | * \since QtDataVisualization 1.0 |
13 | * |
14 | * A bar data item holds the data for a single rendered bar in a graph. |
15 | * Bar data proxies parse data into QBarDataItem instances for visualization. |
16 | * |
17 | * \sa QBarDataProxy, {Qt Data Visualization C++ Classes} |
18 | */ |
19 | |
20 | /*! |
21 | * Constructs a bar data item. |
22 | */ |
23 | QBarDataItem::QBarDataItem() |
24 | : d_ptr(0), // private data doesn't exist by default (optimization) |
25 | m_value(0.0f), |
26 | m_angle(0.0f) |
27 | { |
28 | } |
29 | |
30 | /*! |
31 | * Constructs a bar data item with the value \a value. |
32 | */ |
33 | QBarDataItem::QBarDataItem(float value) |
34 | : d_ptr(0), |
35 | m_value(value), |
36 | m_angle(0.0f) |
37 | { |
38 | } |
39 | |
40 | /*! |
41 | * Constructs a bar data item with the value \a value and angle \a angle. |
42 | */ |
43 | QBarDataItem::QBarDataItem(float value, float angle) |
44 | : d_ptr(0), |
45 | m_value(value), |
46 | m_angle(angle) |
47 | { |
48 | } |
49 | |
50 | /*! |
51 | * Constructs a copy of \a other. |
52 | */ |
53 | QBarDataItem::QBarDataItem(const QBarDataItem &other) |
54 | { |
55 | operator=(other); |
56 | } |
57 | |
58 | /*! |
59 | * Deletes a bar data item. |
60 | */ |
61 | QBarDataItem::~QBarDataItem() |
62 | { |
63 | delete d_ptr; |
64 | } |
65 | |
66 | /*! |
67 | * Assigns a copy of \a other to this object. |
68 | */ |
69 | QBarDataItem &QBarDataItem::operator=(const QBarDataItem &other) |
70 | { |
71 | m_value = other.m_value; |
72 | m_angle = other.m_angle; |
73 | if (other.d_ptr) |
74 | createExtraData(); |
75 | else |
76 | d_ptr = 0; |
77 | return *this; |
78 | } |
79 | |
80 | /*! |
81 | * \fn void QBarDataItem::setValue(float val) |
82 | * Sets the value \a val to this data item. |
83 | */ |
84 | |
85 | /*! |
86 | * \fn float QBarDataItem::value() const |
87 | * Returns the value of this data item. |
88 | */ |
89 | |
90 | /*! |
91 | * \fn void QBarDataItem::setRotation(float angle) |
92 | * Sets the rotation angle \a angle in degrees for this data item. |
93 | */ |
94 | |
95 | /*! |
96 | * \fn float QBarDataItem::rotation() const |
97 | * Returns the rotation angle in degrees for this data item. |
98 | */ |
99 | |
100 | /*! |
101 | * \internal |
102 | */ |
103 | void QBarDataItem::() |
104 | { |
105 | if (!d_ptr) |
106 | d_ptr = new QBarDataItemPrivate; |
107 | } |
108 | |
109 | QBarDataItemPrivate::QBarDataItemPrivate() |
110 | { |
111 | } |
112 | |
113 | QBarDataItemPrivate::~QBarDataItemPrivate() |
114 | { |
115 | } |
116 | |
117 | QT_END_NAMESPACE |
118 | |