KD Chart 2: KDChartValueTrackerAttributes.cpp Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# KDChartValueTrackerAttributes.cpp

Go to the documentation of this file.

    00001 /****************************************************************************
    00002  ** Copyright (C) 2007 Klaralvdalens Datakonsult AB.  All rights reserved.
    00003  **
    00004  ** This file is part of the KD Chart library.
    00005  **
    00006  ** This file may be distributed and/or modified under the terms of the
    00007  ** GNU General Public License version 2 as published by the Free Software
    00008  ** Foundation and appearing in the file LICENSE.GPL included in the
    00009  ** packaging of this file.
    00010  **
    00011  ** Licensees holding valid commercial KD Chart licenses may use this file in
    00012  ** accordance with the KD Chart Commercial License Agreement provided with
    00013  ** the Software.
    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  ** See http://www.kdab.net/kdchart for
    00019  **   information about KDChart Commercial License Agreements.
    00020  **
    00021  ** Contact info@kdab.net if any conditions of this
    00022  ** licensing are not clear to you.
    00023  **
    00024  **********************************************************************/
    00025
    00026 #include "KDChartValueTrackerAttributes.h"
    00027
    00028 #include <KDABLibFakes>
    00029 #include <QPen>
    00030 #include <QSizeF>
    00031 #include <QBrush>
    00032
    00033 #define d d_func()
    00034
    00035 using namespace KDChart;
    00036
    00037 class ValueTrackerAttributes::Private
    00038 {
    00039     friend class ValueTrackerAttributes;
    00040     public:
    00041         Private();
    00042     private:
    00043         QPen pen;
    00044         QSizeF markerSize;
    00045         bool enabled;
    00046         QBrush areaBrush;
    00047 };
    00048
    00049 ValueTrackerAttributes::Private::Private()
    00050     : pen( QPen( QColor( 80, 80, 80, 200 ) ) ),
    00051       markerSize( QSizeF( 6.0, 6.0 ) ),
    00052       enabled( false ),
    00053       areaBrush( QBrush() )
    00054 {
    00055 }
    00056
    00057
    00058 ValueTrackerAttributes::ValueTrackerAttributes()
    00059     : _d( new Private() )
    00060 {
    00061 }
    00062
    00063 ValueTrackerAttributes::ValueTrackerAttributes( const ValueTrackerAttributes& r )
    00064     : _d( new Private( *r.d ) )
    00065 {
    00066 }
    00067
    00068 ValueTrackerAttributes & ValueTrackerAttributes::operator=( const ValueTrackerAttributes& r )
    00069 {
    00070     if( this == &r )
    00071         return *this;
    00072
    00073     *d = *r.d;
    00074
    00075     return *this;
    00076 }
    00077
    00078 ValueTrackerAttributes::~ValueTrackerAttributes()
    00079 {
    00080     delete _d; _d = 0;
    00081 }
    00082
    00083
    00084 bool ValueTrackerAttributes::operator==( const ValueTrackerAttributes& r ) const
    00085 {
    00086     return ( pen() == r.pen() &&
    00087              areaBrush() == r.areaBrush() &&
    00088              markerSize() == r.markerSize() &&
    00089              isEnabled() == r.isEnabled() );
    00090 }
    00091
    00092 void ValueTrackerAttributes::setPen( const QPen& pen )
    00093 {
    00094     d->pen = pen;
    00095 }
    00096
    00097 QPen ValueTrackerAttributes::pen() const
    00098 {
    00099     return d->pen;
    00100 }
    00101
    00102 void ValueTrackerAttributes::setAreaBrush( const QBrush& brush )
    00103 {
    00104     d->areaBrush = brush;
    00105 }
    00106
    00107 QBrush ValueTrackerAttributes::areaBrush() const
    00108 {
    00109     return d->areaBrush;
    00110 }
    00111
    00112 void ValueTrackerAttributes::setMarkerSize( const QSizeF& size )
    00113 {
    00114     d->markerSize = size;
    00115 }
    00116
    00117 QSizeF ValueTrackerAttributes::markerSize() const
    00118 {
    00119     return d->markerSize;
    00120 }
    00121
    00122 void ValueTrackerAttributes::setEnabled( bool enabled )
    00123 {
    00124     d->enabled = enabled;
    00125 }
    00126
    00127 bool ValueTrackerAttributes::isEnabled() const
    00128 {
    00129     return d->enabled;
    00130 }
    00131
    00132 #if !defined(QT_NO_DEBUG_STREAM)
    00133 QDebug operator<<(QDebug dbg, const KDChart::ValueTrackerAttributes& va)
    00134 {
    00135     dbg << "KDChart::ValueTrackerAttributes("
    00136             << "pen="<<va.pen()
    00137             << "markerSize="<<va.markerSize()
    00138             << "enabled="<<va.isEnabled()
    00139             << ")";
    00140     return dbg;
    00141 }
    00142 #endif /* QT_NO_DEBUG_STREAM */