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 "KDChartValueTrackerAttributes.h" 00024 00025 #include <KDABLibFakes> 00026 #include <QPen> 00027 #include <QSizeF> 00028 #include <QBrush> 00029 00030 #define d d_func() 00031 00032 using namespace KDChart; 00033 00034 class ValueTrackerAttributes::Private 00035 { 00036 friend class ValueTrackerAttributes; 00037 public: 00038 Private(); 00039 private: 00040 QPen pen; 00041 QSizeF markerSize; 00042 bool enabled; 00043 QBrush areaBrush; 00044 }; 00045 00046 ValueTrackerAttributes::Private::Private() 00047 : pen( QPen( QColor( 80, 80, 80, 200 ) ) ), 00048 markerSize( QSizeF( 6.0, 6.0 ) ), 00049 enabled( false ), 00050 areaBrush( QBrush() ) 00051 { 00052 } 00053 00054 00055 ValueTrackerAttributes::ValueTrackerAttributes() 00056 : _d( new Private() ) 00057 { 00058 } 00059 00060 ValueTrackerAttributes::ValueTrackerAttributes( const ValueTrackerAttributes& r ) 00061 : _d( new Private( *r.d ) ) 00062 { 00063 } 00064 00065 ValueTrackerAttributes & ValueTrackerAttributes::operator=( const ValueTrackerAttributes& r ) 00066 { 00067 if( this == &r ) 00068 return *this; 00069 00070 *d = *r.d; 00071 00072 return *this; 00073 } 00074 00075 ValueTrackerAttributes::~ValueTrackerAttributes() 00076 { 00077 delete _d; _d = 0; 00078 } 00079 00080 00081 bool ValueTrackerAttributes::operator==( const ValueTrackerAttributes& r ) const 00082 { 00083 return ( pen() == r.pen() && 00084 areaBrush() == r.areaBrush() && 00085 markerSize() == r.markerSize() && 00086 isEnabled() == r.isEnabled() ); 00087 } 00088 00089 void ValueTrackerAttributes::setPen( const QPen& pen ) 00090 { 00091 d->pen = pen; 00092 } 00093 00094 QPen ValueTrackerAttributes::pen() const 00095 { 00096 return d->pen; 00097 } 00098 00099 void ValueTrackerAttributes::setAreaBrush( const QBrush& brush ) 00100 { 00101 d->areaBrush = brush; 00102 } 00103 00104 QBrush ValueTrackerAttributes::areaBrush() const 00105 { 00106 return d->areaBrush; 00107 } 00108 00109 void ValueTrackerAttributes::setMarkerSize( const QSizeF& size ) 00110 { 00111 d->markerSize = size; 00112 } 00113 00114 QSizeF ValueTrackerAttributes::markerSize() const 00115 { 00116 return d->markerSize; 00117 } 00118 00119 void ValueTrackerAttributes::setEnabled( bool enabled ) 00120 { 00121 d->enabled = enabled; 00122 } 00123 00124 bool ValueTrackerAttributes::isEnabled() const 00125 { 00126 return d->enabled; 00127 } 00128 00129 #if !defined(QT_NO_DEBUG_STREAM) 00130 QDebug operator<<(QDebug dbg, const KDChart::ValueTrackerAttributes& va) 00131 { 00132 dbg << "KDChart::ValueTrackerAttributes(" 00133 << "pen="<<va.pen() 00134 << "markerSize="<<va.markerSize() 00135 << "enabled="<<va.isEnabled() 00136 << ")"; 00137 return dbg; 00138 } 00139 #endif /* QT_NO_DEBUG_STREAM */