KD Chart 2  [rev.2.5]
KDChartValueTrackerAttributes.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2012 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 linePen;
00041         QPen markerPen;
00042         QBrush markerBrush;
00043         QBrush arrowBrush;
00044         QSizeF markerSize;
00045         bool enabled;
00046         QBrush areaBrush;
00047         Qt::Orientations orientations;
00048 };
00049 
00050 ValueTrackerAttributes::Private::Private()
00051     : linePen( QPen( QColor( 80, 80, 80, 200 ) ) ),
00052       markerSize( QSizeF( 6.0, 6.0 ) ),
00053       enabled( false ),
00054       areaBrush( QBrush() ),
00055       orientations(Qt::Vertical|Qt::Horizontal)
00056 {
00057     markerPen = linePen;
00058     arrowBrush = linePen.color();
00059 }
00060 
00061 
00062 ValueTrackerAttributes::ValueTrackerAttributes()
00063     : _d( new Private() )
00064 {
00065 }
00066 
00067 ValueTrackerAttributes::ValueTrackerAttributes( const ValueTrackerAttributes& r )
00068     : _d( new Private( *r.d ) )
00069 {
00070 }
00071 
00072 ValueTrackerAttributes & ValueTrackerAttributes::operator=( const ValueTrackerAttributes& r )
00073 {
00074     if( this == &r )
00075         return *this;
00076 
00077     *d = *r.d;
00078 
00079     return *this;
00080 }
00081 
00082 ValueTrackerAttributes::~ValueTrackerAttributes()
00083 {
00084     delete _d; _d = 0;
00085 }
00086 
00087 
00088 bool ValueTrackerAttributes::operator==( const ValueTrackerAttributes& r ) const
00089 {
00090     return ( linePen() == r.linePen() &&
00091              markerPen() == r.markerPen() &&
00092              markerBrush() == r.markerBrush() &&
00093              arrowBrush() == r.arrowBrush() &&
00094              areaBrush() == r.areaBrush() &&
00095              markerSize() == r.markerSize() &&
00096              isEnabled() == r.isEnabled() );
00097 }
00098 
00099 void ValueTrackerAttributes::setPen( const QPen& pen )
00100 {
00101     d->linePen = pen;
00102     d->markerPen = pen;
00103     d->markerBrush = QBrush();
00104     d->arrowBrush = pen.color();
00105 }
00106 
00107 QPen ValueTrackerAttributes::pen() const
00108 {
00109     return d->linePen;
00110 }
00111 
00112 void ValueTrackerAttributes::setLinePen( const QPen &pen )
00113 {
00114     d->linePen = pen;
00115 }
00116 
00117 QPen ValueTrackerAttributes::linePen() const
00118 {
00119     return d->linePen;
00120 }
00121 
00122 void ValueTrackerAttributes::setMarkerPen( const QPen &pen )
00123 {
00124     d->markerPen = pen;
00125 }
00126 
00127 QPen ValueTrackerAttributes::markerPen() const
00128 {
00129     return d->markerPen;
00130 }
00131 
00132 void ValueTrackerAttributes::setMarkerBrush( const QBrush &brush )
00133 {
00134     d->markerBrush = brush;
00135 }
00136 
00137 QBrush ValueTrackerAttributes::markerBrush() const
00138 {
00139     return d->markerBrush;
00140 }
00141 
00142 void ValueTrackerAttributes::setArrowBrush( const QBrush &brush )
00143 {
00144     d->arrowBrush = brush;
00145 }
00146 
00147 QBrush ValueTrackerAttributes::arrowBrush() const
00148 {
00149     return d->arrowBrush;
00150 }
00151 
00152 void ValueTrackerAttributes::setAreaBrush( const QBrush& brush )
00153 {
00154     d->areaBrush = brush;
00155 }
00156 
00157 QBrush ValueTrackerAttributes::areaBrush() const
00158 {
00159     return d->areaBrush;
00160 }
00161 
00162 void ValueTrackerAttributes::setMarkerSize( const QSizeF& size )
00163 {
00164     d->markerSize = size;
00165 }
00166 
00167 QSizeF ValueTrackerAttributes::markerSize() const
00168 {
00169     return d->markerSize;
00170 }
00171 
00172 Qt::Orientations ValueTrackerAttributes::orientations() const
00173 {
00174     return d->orientations;
00175 }
00176 
00177 void ValueTrackerAttributes::setOrientations( Qt::Orientations orientations )
00178 {
00179     d->orientations = orientations;
00180 }
00181 
00182 void ValueTrackerAttributes::setEnabled( bool enabled )
00183 {
00184     d->enabled = enabled;
00185 }
00186 
00187 bool ValueTrackerAttributes::isEnabled() const
00188 {
00189     return d->enabled;
00190 }
00191 
00192 #if !defined(QT_NO_DEBUG_STREAM)
00193 QDebug operator<<(QDebug dbg, const KDChart::ValueTrackerAttributes& va)
00194 {
00195     dbg << "KDChart::ValueTrackerAttributes("
00196         << "linePen="<<va.linePen()
00197         << "markerPen="<<va.markerPen()
00198         << "markerBrush="<<va.markerBrush()
00199         << "arrowBrush="<<va.arrowBrush()
00200         << "markerSize="<<va.markerSize()
00201         << "enabled="<<va.isEnabled()
00202         << ")";
00203     return dbg;
00204 }
00205 #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/