KD Chart API Documentation  3.1
KDChartValueTrackerAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
12 
13 #include <KDABLibFakes>
14 #include <QBrush>
15 #include <QPen>
16 #include <QSizeF>
17 
18 #define d d_func()
19 
20 using namespace KDChart;
21 
22 class ValueTrackerAttributes::Private
23 {
24  friend class ValueTrackerAttributes;
25 
26 public:
27  Private();
28 
29 private:
30  QPen linePen;
31  QPen markerPen;
32  QBrush markerBrush;
33  QBrush arrowBrush;
34  QSizeF markerSize;
35  bool enabled = false;
36  QBrush areaBrush;
37  Qt::Orientations orientations;
38 };
39 
40 ValueTrackerAttributes::Private::Private()
41  : linePen(QPen(QColor(80, 80, 80, 200)))
42  , markerSize(QSizeF(6.0, 6.0))
43  , areaBrush(QBrush())
44  , orientations(Qt::Vertical | Qt::Horizontal)
45 {
46  markerPen = linePen;
47  arrowBrush = linePen.color();
48 }
49 
50 ValueTrackerAttributes::ValueTrackerAttributes()
51  : _d(new Private())
52 {
53 }
54 
56  : _d(new Private(*r.d))
57 {
58 }
59 
61 {
62  if (this == &r)
63  return *this;
64 
65  *d = *r.d;
66 
67  return *this;
68 }
69 
71 {
72  delete _d;
73  _d = nullptr;
74 }
75 
77 {
78  return (linePen() == r.linePen() && markerPen() == r.markerPen() && markerBrush() == r.markerBrush() && arrowBrush() == r.arrowBrush() && areaBrush() == r.areaBrush() && markerSize() == r.markerSize() && isEnabled() == r.isEnabled());
79 }
80 
81 void ValueTrackerAttributes::setPen(const QPen &pen)
82 {
83  d->linePen = pen;
84  d->markerPen = pen;
85  d->markerBrush = QBrush();
86  d->arrowBrush = pen.color();
87 }
88 
90 {
91  return d->linePen;
92 }
93 
95 {
96  d->linePen = pen;
97 }
98 
100 {
101  return d->linePen;
102 }
103 
105 {
106  d->markerPen = pen;
107 }
108 
110 {
111  return d->markerPen;
112 }
113 
114 void ValueTrackerAttributes::setMarkerBrush(const QBrush &brush)
115 {
116  d->markerBrush = brush;
117 }
118 
120 {
121  return d->markerBrush;
122 }
123 
124 void ValueTrackerAttributes::setArrowBrush(const QBrush &brush)
125 {
126  d->arrowBrush = brush;
127 }
128 
130 {
131  return d->arrowBrush;
132 }
133 
134 void ValueTrackerAttributes::setAreaBrush(const QBrush &brush)
135 {
136  d->areaBrush = brush;
137 }
138 
140 {
141  return d->areaBrush;
142 }
143 
145 {
146  d->markerSize = size;
147 }
148 
150 {
151  return d->markerSize;
152 }
153 
154 Qt::Orientations ValueTrackerAttributes::orientations() const
155 {
156  return d->orientations;
157 }
158 
159 void ValueTrackerAttributes::setOrientations(Qt::Orientations orientations)
160 {
161  d->orientations = orientations;
162 }
163 
165 {
166  d->enabled = enabled;
167 }
168 
170 {
171  return d->enabled;
172 }
173 
174 #if !defined(QT_NO_DEBUG_STREAM)
175 QDebug operator<<(QDebug dbg, const KDChart::ValueTrackerAttributes &va)
176 {
177  dbg << "KDChart::ValueTrackerAttributes("
178  << "linePen=" << va.linePen()
179  << "markerPen=" << va.markerPen()
180  << "markerBrush=" << va.markerBrush()
181  << "arrowBrush=" << va.arrowBrush()
182  << "markerSize=" << va.markerSize()
183  << "enabled=" << va.isEnabled()
184  << ")";
185  return dbg;
186 }
187 #endif /* QT_NO_DEBUG_STREAM */
Cell-specific attributes regarding value tracking.
void setOrientations(Qt::Orientations orientations)
bool operator==(const ValueTrackerAttributes &) const
ValueTrackerAttributes & operator=(const ValueTrackerAttributes &)
QDebug operator<<(QDebug stream, const DataDimension &r)

© 2001 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/
Generated by doxygen 1.9.1