KD Chart 2  [rev.2.7]
KDChartLineAttributes.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 "KDChartLineAttributes.h"
24 #include <QDebug>
25 
26 #include <KDABLibFakes>
27 
28 #define d d_func()
29 
30 using namespace KDChart;
31 
32 class LineAttributes::Private
33 {
34  friend class LineAttributes;
35 public:
36  Private();
37 
38 private:
39  //Areas
41  bool displayArea;
42  uint transparency;
44 };
45 
46 
47 LineAttributes::Private::Private()
49  , displayArea( false )
50  , transparency( 255 )
51  , areaBoundingDataset( -1 )
52 {
53 }
54 
55 
57  : _d( new Private() )
58 {
59 }
60 
62  : _d( new Private( *r.d ) )
63 {
64 }
65 
67 {
68  if ( this == &r )
69  return *this;
70 
71  *d = *r.d;
72 
73  return *this;
74 }
75 
77 {
78  delete _d; _d = 0;
79 }
80 
82 {
83  return
85  displayArea() == r.displayArea() &&
86  transparency() == r.transparency() &&
88 }
89 
91 {
92  d->missingValuesPolicy = policy;
93 }
94 
96 {
97  return d->missingValuesPolicy;
98 }
99 
100 void LineAttributes::setDisplayArea( bool display )
101 {
102  d->displayArea = display;
103 }
104 
106 {
107  return d->displayArea;
108 }
109 
111 {
112  if ( alpha > 255 )
113  alpha = 255;
114  d->transparency = alpha;
115 }
116 
118 {
119  return d->transparency;
120 }
121 
123 {
124  d->areaBoundingDataset = dataset;
125 }
126 
128 {
129  return d->areaBoundingDataset;
130 }
131 
132 #if !defined(QT_NO_DEBUG_STREAM)
133 QDebug operator<<(QDebug dbg, const KDChart::LineAttributes& a)
134 {
135  dbg << "KDChart::LineAttributes("
136  // MissingValuesPolicy missingValuesPolicy;
137  << "bool="<<a.displayArea()
138  << "transparency="<<a.transparency()
139  << "areaBoundingDataset="<<a.areaBoundingDataset()
140  << ")";
141  return dbg;
142 
143 }
144 #endif /* QT_NO_DEBUG_STREAM */
bool operator==(const LineAttributes &) const
void setMissingValuesPolicy(MissingValuesPolicy policy)
LineAttributes & operator=(const LineAttributes &)
#define d
Set of attributes for changing the appearance of line charts.
MissingValuesPolicy
MissingValuesPolicy specifies how a missing value will be shown in a line diagram.
QDebug operator<<(QDebug stream, const DataDimension &r)
void setAreaBoundingDataset(int dataset)
Sets the lower or upper (depending on the displayed value being positive or negative, resp.) bounding line (i.e., the dataset with the line data).
MissingValuesPolicy missingValuesPolicy() const

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/