KDChartBackgroundAttributes.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2011 Klaralvdalens Datakonsult AB.  All rights reserved.
00003 **
00004 ** This file is part of the KD Chart library.
00005 **
00006 ** Licensees holding valid commercial KD Chart licenses may use this file in
00007 ** accordance with the KD Chart Commercial License Agreement provided with
00008 ** the Software.
00009 **
00010 **
00011 ** This file may be distributed and/or modified under the terms of the
00012 ** GNU General Public License version 2 and version 3 as published by the
00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
00014 **
00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 **
00018 ** Contact info@kdab.com if any conditions of this licensing are not
00019 ** clear to you.
00020 **
00021 **********************************************************************/
00022 
00023 #include "KDChartBackgroundAttributes.h"
00024 #include <QPixmap>
00025 
00026 #include <KDABLibFakes>
00027 
00028 #define d d_func()
00029 
00030 
00031 using namespace KDChart;
00032 
00033 class BackgroundAttributes::Private
00034 {
00035     friend class KDChart::BackgroundAttributes;
00036 public:
00037     Private();
00038 private:
00039     bool visible;
00040     QBrush brush;
00041     BackgroundPixmapMode pixmapMode;
00042     QPixmap pixmap;
00043 };
00044 
00045 BackgroundAttributes::Private::Private() :
00046     visible( false ),
00047     pixmapMode( BackgroundAttributes::BackgroundPixmapModeNone )
00048 {
00049 }
00050 
00051 
00052 BackgroundAttributes::BackgroundAttributes()
00053     : _d( new Private() )
00054 {
00055 }
00056 
00057 BackgroundAttributes::BackgroundAttributes( const BackgroundAttributes& r )
00058     : _d( new Private( *r.d ) )
00059 {
00060 }
00061 
00062 BackgroundAttributes & BackgroundAttributes::operator=( const BackgroundAttributes& r )
00063 {
00064     if( this == &r )
00065         return *this;
00066 
00067     *d = *r.d;
00068 
00069     return *this;
00070 }
00071 
00072 bool BackgroundAttributes::operator==( const BackgroundAttributes& r ) const
00073 {
00074     return isEqualTo( r );
00075 }
00076 
00077 
00078 bool BackgroundAttributes::isEqualTo(
00079         const BackgroundAttributes& other, bool ignorePixmap ) const
00080 {
00081     /*
00082     qDebug() << "BackgroundAttributes::operator==";
00083     qDebug() << "isVisible" << (isVisible() == other.isVisible());
00084     qDebug() << "brush"     << (brush() == other.brush());
00085     qDebug() << "pixmapMode"<< (pixmapMode() == other.pixmapMode());
00086     qDebug() << "pixmap"    << (pixmap().serialNumber() == other.pixmap().serialNumber());
00087     */
00088     return (
00089             isVisible()  == other.isVisible() &&
00090             brush()      == other.brush() &&
00091             pixmapMode() == other.pixmapMode() &&
00092             (ignorePixmap ||
00093             pixmap().serialNumber() == other.pixmap().serialNumber()) );
00094 }
00095 
00096 
00097 BackgroundAttributes::~BackgroundAttributes()
00098 {
00099     delete _d; _d = 0;
00100 }
00101 
00102 
00103 
00104 
00105 void BackgroundAttributes::setVisible( bool visible )
00106 {
00107     d->visible = visible;
00108 }
00109 
00110 
00111 bool BackgroundAttributes::isVisible() const
00112 {
00113     return d->visible;
00114 }
00115 
00116 void BackgroundAttributes::setBrush( const QBrush &brush )
00117 {
00118     d->brush = brush;
00119 }
00120 
00121 QBrush BackgroundAttributes::brush() const
00122 {
00123     return d->brush;
00124 }
00125 
00126 void BackgroundAttributes::setPixmapMode( BackgroundPixmapMode mode )
00127 {
00128     d->pixmapMode = mode;
00129 }
00130 
00131 BackgroundAttributes::BackgroundPixmapMode BackgroundAttributes::pixmapMode() const
00132 {
00133     return d->pixmapMode;
00134 }
00135 
00136 void BackgroundAttributes::setPixmap( const QPixmap &backPixmap )
00137 {
00138     d->pixmap = backPixmap;
00139 }
00140 
00141 QPixmap BackgroundAttributes::pixmap() const
00142 {
00143     return d->pixmap;
00144 }
00145 
00146 #if !defined(QT_NO_DEBUG_STREAM)
00147 QDebug operator<<(QDebug dbg, const KDChart::BackgroundAttributes& ba)
00148 {
00149     dbg << "KDChart::BackgroundAttributes("
00150         << "visible="<<ba.isVisible()
00151         << "brush="<<ba.brush()
00152         << "pixmapmode="<<ba.pixmapMode()
00153         << "pixmap="<<ba.pixmap()
00154         << ")";
00155     return dbg;
00156 }
00157 #endif /* QT_NO_DEBUG_STREAM */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

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