KD Chart 2  [rev.2.8]
KDChartBarAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2021 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #include "KDChartBarAttributes.h"
24 #include <qglobal.h>
25 
26 #include <KDABLibFakes>
27 
28 #define d d_func()
29 
30 
31 using namespace KDChart;
32 
33 class BarAttributes::Private
34 {
35  friend class BarAttributes;
36 public:
37  Private();
38 
39 private:
40  qreal datasetGap;
41  bool useFixedDatasetGap;
42  qreal valueBlockGap;
44  qreal barWidth;
45  bool useFixedBarWidth;
47  qreal groupGapFactor;
48  qreal barGapFactor;
49 };
50 
51 
52 BarAttributes::Private::Private()
53  :datasetGap( 6 ),
54  useFixedDatasetGap( false ),
55  valueBlockGap( 24 ),
56  useFixedValueBlockGap( false ),
57  barWidth( -1 ),
58  useFixedBarWidth( false ),
59  drawSolidExcessArrows( false ),
60  groupGapFactor( 2.0 ),
61  barGapFactor( 0.4 )
62 {
63 }
64 
65 
66 BarAttributes::BarAttributes()
67  : _d( new Private() )
68 {
69 }
70 
72  : _d( new Private( *r.d ) )
73 {
74 }
75 
77 {
78  if ( this == &r )
79  return *this;
80 
81  *d = *r.d;
82 
83  return *this;
84 }
85 
87 {
88  delete _d; _d = 0;
89 }
90 
91 
93 {
94  if ( fixedDataValueGap() == r.fixedDataValueGap() &&
98  fixedBarWidth() == r.fixedBarWidth() &&
100  groupGapFactor() == r.groupGapFactor() &&
101  barGapFactor() == r.barGapFactor() &&
103  return true;
104  else
105  return false;
106 }
107 
108 
110 {
111  d->datasetGap = gap;
112 }
113 
115 {
116  return d->datasetGap;
117 }
118 
120 {
121  d->useFixedDatasetGap = gapIsFixed;
122 }
123 
125 {
126  return d->useFixedDatasetGap;
127 }
128 
130 {
131  d->valueBlockGap = gap;
132 }
133 
135 {
136  return d->valueBlockGap;
137 }
138 
140 {
141  d->useFixedValueBlockGap = gapIsFixed;
142 }
143 
145 {
146  return d->useFixedValueBlockGap;
147 }
148 
150 {
151  d->barWidth = width;
152 }
153 
155 {
156 
157  return d->barWidth;
158 }
159 
160 void BarAttributes::setUseFixedBarWidth( bool useFixedBarWidth )
161 {
162  d->useFixedBarWidth = useFixedBarWidth;
163 }
164 
166 {
167  return d->useFixedBarWidth;
168 }
169 
170 void BarAttributes::setGroupGapFactor( qreal gapFactor )
171 {
172  d->groupGapFactor = gapFactor;
173 }
174 
176 {
177  return d->groupGapFactor;
178 }
179 
180 void BarAttributes::setBarGapFactor( qreal gapFactor )
181 {
182  d->barGapFactor = gapFactor;
183 }
184 
186 {
187  return d->barGapFactor;
188 }
189 
191 {
192  d->drawSolidExcessArrows = solidArrows;
193 }
194 
196 {
197  return d->drawSolidExcessArrows;
198 }
199 
KDChart::BarAttributes::fixedDataValueGap
qreal fixedDataValueGap() const
Definition: KDChartBarAttributes.cpp:114
KDChart::BarAttributes::setFixedValueBlockGap
void setFixedValueBlockGap(qreal gap)
Definition: KDChartBarAttributes.cpp:129
KDChart::BarAttributes::BarAttributes
BarAttributes()
Definition: KDChartBarAttributes.cpp:66
KDChart::BarAttributes::setDrawSolidExcessArrows
void setDrawSolidExcessArrows(bool solidArrows)
Definition: KDChartBarAttributes.cpp:190
d
#define d
Definition: KDChartBarAttributes.cpp:28
KDChart::BarAttributes::~BarAttributes
~BarAttributes()
Definition: KDChartBarAttributes.cpp:86
KDChart::BarAttributes::setFixedDataValueGap
void setFixedDataValueGap(qreal gap)
Definition: KDChartBarAttributes.cpp:109
KDChart::BarAttributes::setUseFixedDataValueGap
void setUseFixedDataValueGap(bool gapIsFixed)
Definition: KDChartBarAttributes.cpp:119
KDChart
Definition: KDChartAbstractCartesianDiagram.h:30
KDChart::BarAttributes::operator=
BarAttributes & operator=(const BarAttributes &)
Definition: KDChartBarAttributes.cpp:76
KDChart::BarAttributes::setBarGapFactor
void setBarGapFactor(qreal gapFactor)
Definition: KDChartBarAttributes.cpp:180
KDChart::BarAttributes::setFixedBarWidth
void setFixedBarWidth(qreal width)
Definition: KDChartBarAttributes.cpp:149
KDChart::BarAttributes::setUseFixedBarWidth
void setUseFixedBarWidth(bool useFixedBarWidth)
Definition: KDChartBarAttributes.cpp:160
KDChart::BarAttributes::useFixedDataValueGap
bool useFixedDataValueGap() const
Definition: KDChartBarAttributes.cpp:124
KDChart::BarAttributes::useFixedBarWidth
bool useFixedBarWidth() const
Definition: KDChartBarAttributes.cpp:165
KDChart::BarAttributes::setUseFixedValueBlockGap
void setUseFixedValueBlockGap(bool gapIsFixed)
Definition: KDChartBarAttributes.cpp:139
KDChart::BarAttributes::groupGapFactor
qreal groupGapFactor() const
Definition: KDChartBarAttributes.cpp:175
KDChart::BarAttributes
Set of attributes for changing the appearance of bar charts.
Definition: KDChartBarAttributes.h:35
KDChart::BarAttributes::barGapFactor
qreal barGapFactor() const
Definition: KDChartBarAttributes.cpp:185
KDChart::BarAttributes::operator==
bool operator==(const BarAttributes &) const
Definition: KDChartBarAttributes.cpp:92
KDChart::BarAttributes::fixedBarWidth
qreal fixedBarWidth() const
Definition: KDChartBarAttributes.cpp:154
KDChart::BarAttributes::setGroupGapFactor
void setGroupGapFactor(qreal gapFactor)
Definition: KDChartBarAttributes.cpp:170
KDChart::BarAttributes::drawSolidExcessArrows
bool drawSolidExcessArrows() const
Definition: KDChartBarAttributes.cpp:195
KDChartBarAttributes.h
KDChart::BarAttributes::useFixedValueBlockGap
bool useFixedValueBlockGap() const
Definition: KDChartBarAttributes.cpp:144
KDChart::BarAttributes::fixedValueBlockGap
qreal fixedValueBlockGap() const
Definition: KDChartBarAttributes.cpp:134

Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/

https://www.kdab.com/development-resources/qt-tools/kd-chart/