1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#include "variantbardatamapping.h"
31
32VariantBarDataMapping::VariantBarDataMapping()
33 : QObject(0),
34 m_rowIndex(0),
35 m_columnIndex(1),
36 m_valueIndex(2)
37{
38}
39
40VariantBarDataMapping::VariantBarDataMapping(const VariantBarDataMapping &other)
41 : QObject(0),
42 m_rowIndex(0),
43 m_columnIndex(1),
44 m_valueIndex(2)
45{
46 operator=(other);
47}
48
49VariantBarDataMapping::VariantBarDataMapping(int rowIndex, int columnIndex, int valueIndex,
50 const QStringList &rowCategories,
51 const QStringList &columnCategories)
52 : QObject(0),
53 m_rowIndex(0),
54 m_columnIndex(1),
55 m_valueIndex(2)
56{
57 m_rowIndex = rowIndex;
58 m_columnIndex = columnIndex;
59 m_valueIndex = valueIndex;
60 m_rowCategories = rowCategories;
61 m_columnCategories = columnCategories;
62}
63
64VariantBarDataMapping::~VariantBarDataMapping()
65{
66}
67
68VariantBarDataMapping &VariantBarDataMapping::operator=(const VariantBarDataMapping &other)
69{
70 m_rowIndex = other.m_rowIndex;
71 m_columnIndex = other.m_columnIndex;
72 m_valueIndex = other.m_valueIndex;
73 m_rowCategories = other.m_rowCategories;
74 m_columnCategories = other.m_columnCategories;
75
76 return *this;
77}
78
79void VariantBarDataMapping::setRowIndex(int index)
80{
81 m_rowIndex = index;
82 emit mappingChanged();
83}
84
85int VariantBarDataMapping::rowIndex() const
86{
87 return m_rowIndex;
88}
89
90void VariantBarDataMapping::setColumnIndex(int index)
91{
92 m_columnIndex = index;
93 emit mappingChanged();
94}
95
96int VariantBarDataMapping::columnIndex() const
97{
98 return m_columnIndex;
99}
100
101void VariantBarDataMapping::setValueIndex(int index)
102{
103 m_valueIndex = index;
104 emit mappingChanged();
105}
106
107int VariantBarDataMapping::valueIndex() const
108{
109 return m_valueIndex;
110}
111
112void VariantBarDataMapping::setRowCategories(const QStringList &categories)
113{
114 m_rowCategories = categories;
115 emit mappingChanged();
116}
117
118const QStringList &VariantBarDataMapping::rowCategories() const
119{
120 return m_rowCategories;
121}
122
123void VariantBarDataMapping::setColumnCategories(const QStringList &categories)
124{
125 m_columnCategories = categories;
126 emit mappingChanged();
127}
128
129const QStringList &VariantBarDataMapping::columnCategories() const
130{
131 return m_columnCategories;
132}
133
134void VariantBarDataMapping::remap(int rowIndex, int columnIndex, int valueIndex,
135 const QStringList &rowCategories,
136 const QStringList &columnCategories)
137{
138 m_rowIndex = rowIndex;
139 m_columnIndex = columnIndex;
140 m_valueIndex = valueIndex;
141 m_rowCategories = rowCategories;
142 m_columnCategories = columnCategories;
143 emit mappingChanged();
144}
145

source code of qtdatavis3d/examples/datavisualization/customproxy/variantbardatamapping.cpp