KD Chart API Documentation  3.1
KDChartBackgroundAttributes.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
12 #include <QPixmap>
13 
14 #include <KDABLibFakes>
15 
16 #define d d_func()
17 
18 using namespace KDChart;
19 
20 class BackgroundAttributes::Private
21 {
22  friend class KDChart::BackgroundAttributes;
23 
24 public:
25  Private();
26 
27 private:
28  bool visible = false;
29  QBrush brush;
31  QPixmap pixmap;
32 };
33 
34 BackgroundAttributes::Private::Private()
35 {
36 }
37 
39  : _d(new Private())
40 {
41 }
42 
44  : _d(new Private(*r.d))
45 {
46 }
47 
49 {
50  if (this == &r)
51  return *this;
52 
53  *d = *r.d;
54 
55  return *this;
56 }
57 
59 {
60  return isEqualTo(r);
61 }
62 
64  const BackgroundAttributes &other, bool ignorePixmap) const
65 {
66  /*
67  qDebug() << "BackgroundAttributes::operator==";
68  qDebug() << "isVisible" << (isVisible() == other.isVisible());
69  qDebug() << "brush" << (brush() == other.brush());
70  qDebug() << "pixmapMode"<< (pixmapMode() == other.pixmapMode());
71  qDebug() << "pixmap" << (pixmap().serialNumber() == other.pixmap().serialNumber());
72  */
73  return (
74  isVisible() == other.isVisible() && brush() == other.brush() && pixmapMode() == other.pixmapMode() && (ignorePixmap || pixmap().cacheKey() == other.pixmap().cacheKey()));
75 }
76 
78 {
79  delete _d;
80  _d = nullptr;
81 }
82 
84 {
85  d->visible = visible;
86 }
87 
89 {
90  return d->visible;
91 }
92 
94 {
95  d->brush = brush;
96 }
97 
99 {
100  return d->brush;
101 }
102 
104 {
105  d->pixmapMode = mode;
106 }
107 
109 {
110  return d->pixmapMode;
111 }
112 
113 void BackgroundAttributes::setPixmap(const QPixmap &backPixmap)
114 {
115  d->pixmap = backPixmap;
116 }
117 
119 {
120  return d->pixmap;
121 }
122 
123 #if !defined(QT_NO_DEBUG_STREAM)
124 QDebug operator<<(QDebug dbg, const KDChart::BackgroundAttributes &ba)
125 {
126  dbg << "KDChart::BackgroundAttributes("
127  << "visible=" << ba.isVisible()
128  << "brush=" << ba.brush()
129  << "pixmapmode=" << ba.pixmapMode()
130  << "pixmap=" << ba.pixmap().cacheKey()
131  << ")";
132  return dbg;
133 }
134 #endif /* QT_NO_DEBUG_STREAM */
BackgroundPixmapMode pixmapMode() const
BackgroundAttributes & operator=(const BackgroundAttributes &)
void setPixmap(const QPixmap &backPixmap)
void setPixmapMode(BackgroundPixmapMode mode)
bool operator==(const BackgroundAttributes &) const
bool isEqualTo(const BackgroundAttributes &other, bool ignorePixmap=false) const
QDebug operator<<(QDebug stream, const DataDimension &r)

© 2001 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/
Generated by doxygen 1.9.1