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

source code of qtgraphs/src/graphs/data/qbardataitem.cpp