KD Chart 2  [rev.2.7]
KDChartMarkerAttributes.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 #include <QColor>
25 #include <QMap>
26 #include <QPen>
27 #include <QPainterPath>
28 #include <QSizeF>
29 #include <QDebug>
30 #include <qglobal.h>
31 
32 #include <KDABLibFakes>
33 
34 using namespace KDChart;
35 
36 class MarkerAttributes::Private
37 {
38  friend class ::KDChart::MarkerAttributes;
39 public:
40  Private();
41 private:
42  bool visible;
43  bool threeD;
45  uint markerStyle;
46  QSizeF markerSize;
47  QColor markerColor;
48  QPainterPath customMarkerPath;
49  QPen markerPen;
50 };
51 
52 MarkerAttributes::Private::Private()
53  : visible( false ),
54  threeD( false ),
56  markerSize( 10, 10 ),
57  markerPen( Qt::black )
58 {
59 }
60 
61 
63  : _d( new Private )
64 {
65 
66 }
67 
69  : _d( new Private( *r._d ) )
70 {
71 
72 }
73 
75 {
76  MarkerAttributes copy( r );
77  copy.swap( *this );
78  return *this;
79 }
80 
82 {
83  delete _d; _d = 0;
84 }
85 
86 #define d d_func()
87 
89 {
90  /*
91  qDebug() << "MarkerAttributes::operator== finds"
92  << "b" << (isVisible() == r.isVisible())
93  << "c" << (markerStylesMap() == r.markerStylesMap())
94  << "d" << (markerStyle() == r.markerStyle()) << markerStyle() <<r.markerStyle()
95  << "e" << (markerSize() == r.markerSize())
96  << "f" << (markerColor() == r.markerColor())
97  << "p" << (customMarkerPath() == r.customMarkerPath())
98  << "g" << (pen() == r.pen())
99  << "h" << (markerColor() == r.markerColor()) << markerColor() << r.markerColor();
100  */
101  return ( isVisible() == r.isVisible() &&
102  markerStylesMap() == r.markerStylesMap() &&
103  markerStyle() == r.markerStyle() &&
104  markerSize() == r.markerSize() &&
105  markerColor() == r.markerColor() &&
107  pen() == r.pen() );
108 }
109 
110 
111 
112 void MarkerAttributes::setVisible( bool visible )
113 {
114  d->visible = visible;
115 }
116 
118 {
119  return d->visible;
120 }
121 
122 void MarkerAttributes::setThreeD( bool value )
123 {
124  d->threeD = value;
125 }
126 
128 {
129  return d->threeD;
130 }
131 
133 {
134  d->markerStylesMap = map;
135 }
136 
138 {
139  return d->markerStylesMap;
140 }
141 
143 {
144  d->markerStyle = style;
145 }
146 
148 {
149  return d->markerStyle;
150 }
151 
152 void MarkerAttributes::setMarkerSize( const QSizeF& size )
153 {
154  d->markerSize = size;
155 }
156 
158 {
159  return d->markerSize;
160 }
161 
162 void MarkerAttributes::setMarkerColor( const QColor& color )
163 {
164  d->markerColor = color;
165 }
166 
168 {
169  return d->markerColor;
170 }
171 
172 void MarkerAttributes::setCustomMarkerPath( const QPainterPath& path )
173 {
174  d->customMarkerPath = path;
175 }
176 
178 {
179  return d->customMarkerPath;
180 }
181 
182 void MarkerAttributes::setPen( const QPen& pen )
183 {
184  d->markerPen = pen;
185 }
186 
188 {
189  return d->markerPen;
190 }
191 
192 #undef d
193 
194 #ifndef QT_NO_DEBUG_STREAM
195 QDebug operator<<( QDebug dbg, const MarkerAttributes & ma ) {
196  return dbg << "KDChart::MarkerAttributes("
197  << "visible=" << ma.isVisible()
198  << "markerStylesMap=" << ma.markerStylesMap()
199  << "markerStyle=" << ma.markerStyle()
200  << "markerColor=" << ma.markerColor()
201  << "customMarkerPath=" << ma.customMarkerPath()
202  << "pen=" << ma.pen()
203  << ")";
204 }
205 #endif
206 
#define d
void setMarkerSize(const QSizeF &size)
Normally you need to specify a valid QSizeF here, but for Legends you can use the invalid size QSizeF...
MarkerStylesMap markerStylesMap() const
QPainterPath customMarkerPath() const
void setMarkerStylesMap(const MarkerStylesMap &map)
void setMarkerStyle(uint style)
Set the marker-style to use.
void setCustomMarkerPath(const QPainterPath &path)
MarkerAttributes & operator=(const MarkerAttributes &)
void setMarkerColor(const QColor &color)
A set of attributes controlling the appearance of data set markers.
bool operator==(const MarkerAttributes &) const
QDebug operator<<(QDebug stream, const DataDimension &r)

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/