KD Chart 2  [rev.2.7]
KDChartValueTrackerAttributes.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 
24 
25 #include <KDABLibFakes>
26 #include <QPen>
27 #include <QSizeF>
28 #include <QBrush>
29 
30 #define d d_func()
31 
32 using namespace KDChart;
33 
34 class ValueTrackerAttributes::Private
35 {
36  friend class ValueTrackerAttributes;
37  public:
38  Private();
39  private:
40  QPen linePen;
41  QPen markerPen;
42  QBrush markerBrush;
43  QBrush arrowBrush;
44  QSizeF markerSize;
45  bool enabled;
46  QBrush areaBrush;
47  Qt::Orientations orientations;
48 };
49 
50 ValueTrackerAttributes::Private::Private()
51  : linePen( QPen( QColor( 80, 80, 80, 200 ) ) ),
52  markerSize( QSizeF( 6.0, 6.0 ) ),
53  enabled( false ),
54  areaBrush( QBrush() ),
55  orientations(Qt::Vertical|Qt::Horizontal)
56 {
58  arrowBrush = linePen.color();
59 }
60 
61 
63  : _d( new Private() )
64 {
65 }
66 
68  : _d( new Private( *r.d ) )
69 {
70 }
71 
73 {
74  if ( this == &r )
75  return *this;
76 
77  *d = *r.d;
78 
79  return *this;
80 }
81 
83 {
84  delete _d; _d = 0;
85 }
86 
87 
89 {
90  return ( linePen() == r.linePen() &&
91  markerPen() == r.markerPen() &&
92  markerBrush() == r.markerBrush() &&
93  arrowBrush() == r.arrowBrush() &&
94  areaBrush() == r.areaBrush() &&
95  markerSize() == r.markerSize() &&
96  isEnabled() == r.isEnabled() );
97 }
98 
100 {
101  d->linePen = pen;
102  d->markerPen = pen;
103  d->markerBrush = QBrush();
104  d->arrowBrush = pen.color();
105 }
106 
108 {
109  return d->linePen;
110 }
111 
113 {
114  d->linePen = pen;
115 }
116 
118 {
119  return d->linePen;
120 }
121 
123 {
124  d->markerPen = pen;
125 }
126 
128 {
129  return d->markerPen;
130 }
131 
132 void ValueTrackerAttributes::setMarkerBrush( const QBrush &brush )
133 {
134  d->markerBrush = brush;
135 }
136 
138 {
139  return d->markerBrush;
140 }
141 
142 void ValueTrackerAttributes::setArrowBrush( const QBrush &brush )
143 {
144  d->arrowBrush = brush;
145 }
146 
148 {
149  return d->arrowBrush;
150 }
151 
152 void ValueTrackerAttributes::setAreaBrush( const QBrush& brush )
153 {
154  d->areaBrush = brush;
155 }
156 
158 {
159  return d->areaBrush;
160 }
161 
162 void ValueTrackerAttributes::setMarkerSize( const QSizeF& size )
163 {
164  d->markerSize = size;
165 }
166 
168 {
169  return d->markerSize;
170 }
171 
172 Qt::Orientations ValueTrackerAttributes::orientations() const
173 {
174  return d->orientations;
175 }
176 
178 {
179  d->orientations = orientations;
180 }
181 
183 {
184  d->enabled = enabled;
185 }
186 
188 {
189  return d->enabled;
190 }
191 
192 #if !defined(QT_NO_DEBUG_STREAM)
193 QDebug operator<<(QDebug dbg, const KDChart::ValueTrackerAttributes& va)
194 {
195  dbg << "KDChart::ValueTrackerAttributes("
196  << "linePen="<<va.linePen()
197  << "markerPen="<<va.markerPen()
198  << "markerBrush="<<va.markerBrush()
199  << "arrowBrush="<<va.arrowBrush()
200  << "markerSize="<<va.markerSize()
201  << "enabled="<<va.isEnabled()
202  << ")";
203  return dbg;
204 }
205 #endif /* QT_NO_DEBUG_STREAM */
void setOrientations(Qt::Orientations orientations)
Set the orientations used to show the value tracking.
bool operator==(const ValueTrackerAttributes &) const
ValueTrackerAttributes & operator=(const ValueTrackerAttributes &)
void setAreaBrush(const QBrush &brush)
Set the brush the area below the value tracking lines should be filled with.
Cell-specific attributes regarding value tracking.
QDebug operator<<(QDebug stream, const DataDimension &r)
void setMarkerSize(const QSizeF &size)
Set the size of the markers.
void setEnabled(bool enabled)
Set whether value tracking should be enabled for a specific index or not.
void setPen(const QPen &pen)
Set the pen the value tracking lines and markers will be drawn with.

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/