KD Chart 2  [rev.2.7]
KDChartBarAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2020 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 
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 
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 
bool operator==(const BarAttributes &) const
Set of attributes for changing the appearance of bar charts.
BarAttributes & operator=(const BarAttributes &)
void setDrawSolidExcessArrows(bool solidArrows)
#define d
void setUseFixedDataValueGap(bool gapIsFixed)
void setFixedDataValueGap(qreal gap)
void setBarGapFactor(qreal gapFactor)
void setFixedBarWidth(qreal width)
void setUseFixedValueBlockGap(bool gapIsFixed)
void setUseFixedBarWidth(bool useFixedBarWidth)
void setFixedValueBlockGap(qreal gap)
void setGroupGapFactor(qreal gapFactor)

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/