KD Chart 2  [rev.2.5.1]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
KDChartBackgroundAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2013 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 <QPixmap>
25 
26 #include <KDABLibFakes>
27 
28 #define d d_func()
29 
30 
31 using namespace KDChart;
32 
33 class BackgroundAttributes::Private
34 {
35  friend class KDChart::BackgroundAttributes;
36 public:
37  Private();
38 private:
39  bool visible;
40  QBrush brush;
42  QPixmap pixmap;
43 };
44 
45 BackgroundAttributes::Private::Private() :
46  visible( false ),
48 {
49 }
50 
51 
53  : _d( new Private() )
54 {
55 }
56 
58  : _d( new Private( *r.d ) )
59 {
60 }
61 
63 {
64  if ( this == &r )
65  return *this;
66 
67  *d = *r.d;
68 
69  return *this;
70 }
71 
73 {
74  return isEqualTo( r );
75 }
76 
77 
79  const BackgroundAttributes& other, bool ignorePixmap ) const
80 {
81  /*
82  qDebug() << "BackgroundAttributes::operator==";
83  qDebug() << "isVisible" << (isVisible() == other.isVisible());
84  qDebug() << "brush" << (brush() == other.brush());
85  qDebug() << "pixmapMode"<< (pixmapMode() == other.pixmapMode());
86  qDebug() << "pixmap" << (pixmap().serialNumber() == other.pixmap().serialNumber());
87  */
88  return (
89  isVisible() == other.isVisible() &&
90  brush() == other.brush() &&
91  pixmapMode() == other.pixmapMode() &&
92  (ignorePixmap ||
93  pixmap().cacheKey() == other.pixmap().cacheKey()) );
94 }
95 
96 
98 {
99  delete _d; _d = 0;
100 }
101 
102 
103 
104 
106 {
107  d->visible = visible;
108 }
109 
110 
112 {
113  return d->visible;
114 }
115 
117 {
118  d->brush = brush;
119 }
120 
122 {
123  return d->brush;
124 }
125 
127 {
128  d->pixmapMode = mode;
129 }
130 
132 {
133  return d->pixmapMode;
134 }
135 
136 void BackgroundAttributes::setPixmap( const QPixmap &backPixmap )
137 {
138  d->pixmap = backPixmap;
139 }
140 
142 {
143  return d->pixmap;
144 }
145 
146 #if !defined(QT_NO_DEBUG_STREAM)
147 QDebug operator<<(QDebug dbg, const KDChart::BackgroundAttributes& ba)
148 {
149  dbg << "KDChart::BackgroundAttributes("
150  << "visible="<<ba.isVisible()
151  << "brush="<<ba.brush()
152  << "pixmapmode="<<ba.pixmapMode()
153  << "pixmap="<<ba.pixmap().cacheKey()
154  << ")";
155  return dbg;
156 }
157 #endif /* QT_NO_DEBUG_STREAM */

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/