KChart

KChartBackgroundAttributes.cpp
1/*
2 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3 *
4 * This file is part of the KD Chart library.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "KChartBackgroundAttributes.h"
10
11#include "KChartMath_p.h"
12
13#include <QPixmap>
14
15#define d d_func()
16
17
18using namespace KChart;
19
20class Q_DECL_HIDDEN BackgroundAttributes::Private
21{
23public:
24 Private();
25private:
26 bool visible;
27 QBrush brush;
28 BackgroundPixmapMode pixmapMode;
29 QPixmap pixmap;
30};
31
32BackgroundAttributes::Private::Private() :
33 visible( false ),
34 pixmapMode( BackgroundAttributes::BackgroundPixmapModeNone )
35{
36}
37
38
39BackgroundAttributes::BackgroundAttributes()
40 : _d( new Private() )
41{
42}
43
44BackgroundAttributes::BackgroundAttributes( const BackgroundAttributes& r )
45 : _d( new Private( *r.d ) )
46{
47}
48
49BackgroundAttributes & BackgroundAttributes::operator=( const BackgroundAttributes& r )
50{
51 if ( this == &r )
52 return *this;
53
54 *d = *r.d;
55
56 return *this;
57}
58
59bool BackgroundAttributes::operator==( const BackgroundAttributes& r ) const
60{
61 return isEqualTo( r );
62}
63
64
65bool BackgroundAttributes::isEqualTo(
66 const BackgroundAttributes& other, bool ignorePixmap ) const
67{
68 /*
69 qDebug() << "BackgroundAttributes::operator==";
70 qDebug() << "isVisible" << (isVisible() == other.isVisible());
71 qDebug() << "brush" << (brush() == other.brush());
72 qDebug() << "pixmapMode"<< (pixmapMode() == other.pixmapMode());
73 qDebug() << "pixmap" << (pixmap().serialNumber() == other.pixmap().serialNumber());
74 */
75 return (
76 isVisible() == other.isVisible() &&
77 brush() == other.brush() &&
78 pixmapMode() == other.pixmapMode() &&
79 (ignorePixmap ||
80 pixmap().cacheKey() == other.pixmap().cacheKey()) );
81}
82
83
84BackgroundAttributes::~BackgroundAttributes()
85{
86 delete _d; _d = nullptr;
87}
88
89
90
91
92void BackgroundAttributes::setVisible( bool visible )
93{
94 d->visible = visible;
95}
96
97
98bool BackgroundAttributes::isVisible() const
99{
100 return d->visible;
101}
102
103void BackgroundAttributes::setBrush( const QBrush &brush )
104{
105 d->brush = brush;
106}
107
108QBrush BackgroundAttributes::brush() const
109{
110 return d->brush;
111}
112
113void BackgroundAttributes::setPixmapMode( BackgroundPixmapMode mode )
114{
115 d->pixmapMode = mode;
116}
117
118BackgroundAttributes::BackgroundPixmapMode BackgroundAttributes::pixmapMode() const
119{
120 return d->pixmapMode;
121}
122
123void BackgroundAttributes::setPixmap( const QPixmap &backPixmap )
124{
125 d->pixmap = backPixmap;
126}
127
128QPixmap BackgroundAttributes::pixmap() const
129{
130 return d->pixmap;
131}
132
133#if !defined(QT_NO_DEBUG_STREAM)
135{
136 dbg << "KChart::BackgroundAttributes("
137 << "visible="<<ba.isVisible()
138 << "brush="<<ba.brush()
139 << "pixmapmode="<<ba.pixmapMode()
140 << "pixmap="<<ba.pixmap().cacheKey()
141 << ")";
142 return dbg;
143}
144#endif /* QT_NO_DEBUG_STREAM */
Set of attributes usable for background pixmaps.
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
qint64 cacheKey() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.