1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "barrenderitem_p.h"
5
6QT_BEGIN_NAMESPACE
7
8BarRenderItem::BarRenderItem()
9 : AbstractRenderItem(),
10 m_value(0),
11 m_height(0.0f)
12{
13}
14
15BarRenderItem::BarRenderItem(const BarRenderItem &other)
16 : AbstractRenderItem(other)
17{
18 m_value = other.m_value;
19 m_position = other.m_position;
20 m_height = other.m_height;
21}
22
23BarRenderItem::~BarRenderItem()
24{
25}
26
27BarRenderSliceItem::BarRenderSliceItem()
28 : BarRenderItem(),
29 m_sliceLabelItem(0)
30{
31}
32
33BarRenderSliceItem::BarRenderSliceItem(const BarRenderSliceItem &other)
34 : BarRenderItem(other)
35{
36 m_sliceLabel = other.m_sliceLabel;
37 m_sliceLabelItem = 0;
38}
39
40BarRenderSliceItem::~BarRenderSliceItem()
41{
42 delete m_sliceLabelItem;
43}
44
45void BarRenderSliceItem::setItem(const BarRenderItem &renderItem)
46{
47 m_translation = renderItem.translation();
48 m_rotation = renderItem.rotation();
49 m_value = renderItem.value();
50 m_position = renderItem.position();
51 m_height = renderItem.height();
52 m_sliceLabel = QString();
53 delete m_sliceLabelItem;
54 m_sliceLabelItem = 0;
55}
56
57LabelItem &BarRenderSliceItem::sliceLabelItem()
58{
59 if (!m_sliceLabelItem)
60 m_sliceLabelItem = new LabelItem;
61 return *m_sliceLabelItem;
62}
63
64void BarRenderSliceItem::setSliceLabel(const QString &label)
65{
66 if (m_sliceLabelItem)
67 m_sliceLabelItem->clear();
68 m_sliceLabel = label;
69}
70
71const QString &BarRenderSliceItem::sliceLabel() const
72{
73 return m_sliceLabel;
74}
75
76QT_END_NAMESPACE
77

source code of qtdatavis3d/src/datavisualization/data/barrenderitem.cpp