KChart

KChartValueTrackerAttributes.cpp
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "KChartValueTrackerAttributes.h"
10#include "KChartMath_p.h"
11
12#include <QPen>
13#include <QSizeF>
14#include <QBrush>
15
16#define d d_func()
17
18using namespace KChart;
19
20class Q_DECL_HIDDEN ValueTrackerAttributes::Private
21{
22 friend class ValueTrackerAttributes;
23 public:
24 Private();
25 private:
26 QPen linePen;
27 QPen markerPen;
28 QBrush markerBrush;
29 QBrush arrowBrush;
30 QSizeF markerSize;
31 bool enabled;
32 QBrush areaBrush;
33 Qt::Orientations orientations;
34};
35
36ValueTrackerAttributes::Private::Private()
37 : linePen( QPen( QColor( 80, 80, 80, 200 ) ) ),
38 markerSize( QSizeF( 6.0, 6.0 ) ),
39 enabled( false ),
40 areaBrush( QBrush() ),
42{
43 markerPen = linePen;
44 arrowBrush = linePen.color();
45}
46
47
48ValueTrackerAttributes::ValueTrackerAttributes()
49 : _d( new Private() )
50{
51}
52
53ValueTrackerAttributes::ValueTrackerAttributes( const ValueTrackerAttributes& r )
54 : _d( new Private( *r.d ) )
55{
56}
57
58ValueTrackerAttributes & ValueTrackerAttributes::operator=( const ValueTrackerAttributes& r )
59{
60 if ( this == &r )
61 return *this;
62
63 *d = *r.d;
64
65 return *this;
66}
67
68ValueTrackerAttributes::~ValueTrackerAttributes()
69{
70 delete _d; _d = nullptr;
71}
72
73
74bool ValueTrackerAttributes::operator==( const ValueTrackerAttributes& r ) const
75{
76 return ( linePen() == r.linePen() &&
77 markerPen() == r.markerPen() &&
78 markerBrush() == r.markerBrush() &&
79 arrowBrush() == r.arrowBrush() &&
80 areaBrush() == r.areaBrush() &&
81 markerSize() == r.markerSize() &&
82 isEnabled() == r.isEnabled() );
83}
84
86{
87 d->linePen = pen;
88 d->markerPen = pen;
89 d->markerBrush = QBrush();
90 d->arrowBrush = pen.color();
91}
92
94{
95 return d->linePen;
96}
97
98void ValueTrackerAttributes::setLinePen( const QPen &pen )
99{
100 d->linePen = pen;
101}
102
103QPen ValueTrackerAttributes::linePen() const
104{
105 return d->linePen;
106}
107
108void ValueTrackerAttributes::setMarkerPen( const QPen &pen )
109{
110 d->markerPen = pen;
111}
112
113QPen ValueTrackerAttributes::markerPen() const
114{
115 return d->markerPen;
116}
117
118void ValueTrackerAttributes::setMarkerBrush( const QBrush &brush )
119{
120 d->markerBrush = brush;
121}
122
123QBrush ValueTrackerAttributes::markerBrush() const
124{
125 return d->markerBrush;
126}
127
128void ValueTrackerAttributes::setArrowBrush( const QBrush &brush )
129{
130 d->arrowBrush = brush;
131}
132
133QBrush ValueTrackerAttributes::arrowBrush() const
134{
135 return d->arrowBrush;
136}
137
139{
140 d->areaBrush = brush;
141}
142
144{
145 return d->areaBrush;
146}
147
149{
150 d->markerSize = size;
151}
152
154{
155 return d->markerSize;
156}
157
159{
160 return d->orientations;
161}
162
164{
165 d->orientations = orientations;
166}
167
169{
170 d->enabled = enabled;
171}
172
174{
175 return d->enabled;
176}
177
178#if !defined(QT_NO_DEBUG_STREAM)
179QDebug operator<<(QDebug dbg, const KChart::ValueTrackerAttributes& va)
180{
181 dbg << "KChart::ValueTrackerAttributes("
182 << "linePen="<<va.linePen()
183 << "markerPen="<<va.markerPen()
184 << "markerBrush="<<va.markerBrush()
185 << "arrowBrush="<<va.arrowBrush()
186 << "markerSize="<<va.markerSize()
187 << "enabled="<<va.isEnabled()
188 << ")";
189 return dbg;
190}
191#endif /* QT_NO_DEBUG_STREAM */
Cell-specific attributes regarding value tracking.
void setOrientations(Qt::Orientations orientations)
Set the orientations used to show the value tracking.
void setEnabled(bool enabled)
Set whether value tracking should be enabled for a specific index or not.
void setMarkerSize(const QSizeF &size)
Set the size of the markers.
void setAreaBrush(const QBrush &brush)
Set the brush the area below the value tracking lines should be filled with.
void setPen(const QPen &pen)
Set the pen the value tracking lines and markers will be drawn with.
const QColor & color() const const
QColor color() const const
typedef Orientations
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.