KD Chart 2  [rev.2.7]
KDChartLeveyJenningsGridAttributes.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 <QBrush>
26 #include <QMap>
27 #include <QPen>
28 
29 #include <KDABLibFakes>
30 
31 #define d d_func()
32 
33 using namespace KDChart;
34 
35 class LeveyJenningsGridAttributes::Private
36 {
37  friend class LeveyJenningsGridAttributes;
38 public:
39  Private();
40 private:
41  QMap< GridType, bool > visible;
44 };
45 
46 LeveyJenningsGridAttributes::Private::Private()
47 {
48  pens[ Calculated ].setCapStyle( Qt::FlatCap );
49  pens[ Calculated ].setColor( Qt::blue );
50  pens[ Expected ].setCapStyle( Qt::FlatCap );
51  pens[ Expected ].setColor( Qt::black );
52 
53  visible[ Calculated ] = true;
54  visible[ Expected ] = true;
55 
56  rangeBrushes[ LeveyJenningsGridAttributes::CriticalRange ] = QBrush( QColor( 255, 255, 192 ) );
57  rangeBrushes[ LeveyJenningsGridAttributes::OutOfRange ] = QBrush( QColor( 255, 128, 128 ) );
58 }
59 
60 
62  : _d( new Private() )
63 {
64  // this bloc left empty intentionally
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 isGridVisible( Expected ) == r.isGridVisible( Expected ) &&
92  gridPen( Expected ) == r.gridPen( Expected ) &&
94 }
95 
96 void LeveyJenningsGridAttributes::setRangeBrush( Range range, const QBrush& brush )
97 {
98  d->rangeBrushes[ range ] = brush;
99 }
100 
102 {
103  return d->rangeBrushes[ range ];
104 }
105 
106 
108 {
109  d->visible[ type ] = visible;
110 }
111 
113 {
114  return d->visible[ type ];
115 }
116 
118 {
119  d->pens[ type ] = pen;
120  d->pens[ type ].setCapStyle( Qt::FlatCap );
121 }
122 
124 {
125  return d->pens[ type ];
126 }
void setRangeBrush(Range range, const QBrush &brush)
A set of attributes controlling the appearance of grids.
LeveyJenningsGridAttributes & operator=(const LeveyJenningsGridAttributes &)
bool operator==(const LeveyJenningsGridAttributes &) 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/