KDChart::RulerAttributes Class Reference

#include <KDChartRulerAttributes.h>

List of all members.


Detailed Description

A set of attributes controlling the appearance of axis rulers.

Definition at line 44 of file KDChartRulerAttributes.h.


Public Types

typedef QMap< qreal, QPen > TickMarkerPensMap

Public Member Functions

bool hasTickMarkPenAt (qreal value) const
QPen majorTickMarkPen () const
bool majorTickMarkPenIsSet () const
QPen minorTickMarkPen () const
bool minorTickMarkPenIsSet () const
bool operator!= (const RulerAttributes &other) const
RulerAttributesoperator= (const RulerAttributes &)
bool operator== (const RulerAttributes &) const
 RulerAttributes (const RulerAttributes &)
 RulerAttributes ()
void setMajorTickMarkPen (const QPen &pen)
 Sets the pen used to draw major tick marks.
void setMinorTickMarkPen (const QPen &pen)
 Sets the pen used to draw minor tick marks.
void setShowMajorTickMarks (bool show)
 Shows or hides minor tick marks.
void setShowMinorTickMarks (bool show)
 Shows or hides major tick marks.
void setTickMarkColor (const QColor &color)
 Color setter method provided for convenience.
void setTickMarkPen (qreal value, const QPen &pen)
 Sets the pen used to draw the tick mark at a specific value.
void setTickMarkPen (const QPen &pen)
 Sets the pen used to draw the tick marks.
bool showMajorTickMarks () const
bool showMinorTickMarks () const
QColor tickMarkColor () const
QPen tickMarkPen (qreal value) const
QPen tickMarkPen () const
TickMarkerPensMap tickMarkPens () const
 ~RulerAttributes ()

Member Typedef Documentation

typedef QMap<qreal, QPen> KDChart::RulerAttributes::TickMarkerPensMap

Definition at line 81 of file KDChartRulerAttributes.h.


Constructor & Destructor Documentation

RulerAttributes::RulerAttributes (  ) 

Definition at line 75 of file KDChartRulerAttributes.cpp.

00076     : _d( new Private() )
00077 {
00078     // this bloc left empty intentionally
00079 }

RulerAttributes::RulerAttributes ( const RulerAttributes r  ) 

Definition at line 81 of file KDChartRulerAttributes.cpp.

00082     : _d( new Private( *r.d ) )
00083 {
00084 }

RulerAttributes::~RulerAttributes (  ) 

Definition at line 201 of file KDChartRulerAttributes.cpp.

00202 {
00203     delete _d; _d = 0;
00204 }


Member Function Documentation

bool RulerAttributes::hasTickMarkPenAt ( qreal  value  )  const

Definition at line 150 of file KDChartRulerAttributes.cpp.

References d.

Referenced by KDChart::CartesianAxis::paintCtx().

00151 {
00152         QMapIterator<qreal, QPen> it( d->customTickMarkPens );
00153         while( it.hasNext() ) {
00154                 it.next();
00155                 if ( qAbs( value - it.key() ) < std::numeric_limits< float >::epsilon() )
00156                         return true;
00157         }
00158         return false;
00159 }

QPen RulerAttributes::majorTickMarkPen (  )  const

Definition at line 107 of file KDChartRulerAttributes.cpp.

References d.

Referenced by operator<<(), operator==(), and KDChart::CartesianAxis::paintCtx().

00108 {
00109         return d->majorTickMarkPenIsSet ? d->majorTickMarkPen : d->tickMarkPen;
00110 }

bool RulerAttributes::majorTickMarkPenIsSet (  )  const

Definition at line 102 of file KDChartRulerAttributes.cpp.

References d.

00103 {
00104     return d->majorTickMarkPenIsSet;
00105 }

QPen RulerAttributes::minorTickMarkPen (  )  const

Definition at line 123 of file KDChartRulerAttributes.cpp.

References d.

Referenced by operator<<(), and operator==().

00124 {
00125         return d->minorTickMarkPenIsSet ? d->minorTickMarkPen : d->tickMarkPen;
00126 }

bool RulerAttributes::minorTickMarkPenIsSet (  )  const

Definition at line 118 of file KDChartRulerAttributes.cpp.

References d.

00119 {
00120     return d->minorTickMarkPenIsSet;
00121 }

bool KDChart::RulerAttributes::operator!= ( const RulerAttributes other  )  const

Definition at line 105 of file KDChartRulerAttributes.h.

References KDGantt::operator==().

00105 { return !operator==(other); }

RulerAttributes & RulerAttributes::operator= ( const RulerAttributes r  ) 

Definition at line 191 of file KDChartRulerAttributes.cpp.

References d.

00192 {
00193     if( this == &r )
00194         return *this;
00195 
00196     *d = *r.d;
00197 
00198     return *this;
00199 }

bool RulerAttributes::operator== ( const RulerAttributes r  )  const

Definition at line 207 of file KDChartRulerAttributes.cpp.

References d, majorTickMarkPen(), minorTickMarkPen(), and tickMarkPen().

00208 {
00209     bool isEqual =
00210         tickMarkPen()      == r.tickMarkPen() &&
00211         majorTickMarkPen() == r.majorTickMarkPen() &&
00212         minorTickMarkPen() == r.minorTickMarkPen();
00213     if( isEqual ) {
00214         QMapIterator<qreal, QPen> it( d->customTickMarkPens );
00215         while( it.hasNext() ) {
00216             it.next();
00217             if ( it.value() != r.tickMarkPen(it.key()) )
00218                 return false;
00219         }
00220     }
00221     return isEqual;
00222 }

void RulerAttributes::setMajorTickMarkPen ( const QPen &  pen  ) 

Sets the pen used to draw major tick marks.

Definition at line 96 of file KDChartRulerAttributes.cpp.

References d.

00097 {
00098         d->majorTickMarkPen = pen;
00099         d->majorTickMarkPenIsSet = true;
00100 }

void RulerAttributes::setMinorTickMarkPen ( const QPen &  pen  ) 

Sets the pen used to draw minor tick marks.

Definition at line 112 of file KDChartRulerAttributes.cpp.

References d.

00113 {
00114         d->minorTickMarkPen = pen;
00115         d->minorTickMarkPenIsSet = true;
00116 }

void RulerAttributes::setShowMajorTickMarks ( bool  show  ) 

Shows or hides minor tick marks.

Definition at line 171 of file KDChartRulerAttributes.cpp.

References d.

00172 {
00173     d->showMajorTickMarks = show;
00174 }

void RulerAttributes::setShowMinorTickMarks ( bool  show  ) 

Shows or hides major tick marks.

Definition at line 181 of file KDChartRulerAttributes.cpp.

References d.

00182 {
00183     d->showMinorTickMarks = show;
00184 }

void RulerAttributes::setTickMarkColor ( const QColor &  color  ) 

Color setter method provided for convenience.

Definition at line 161 of file KDChartRulerAttributes.cpp.

References d.

00162 {
00163         d->tickMarkPen.setColor( color );
00164 }

void RulerAttributes::setTickMarkPen ( qreal  value,
const QPen &  pen 
)

Sets the pen used to draw the tick mark at a specific value.

Note: This will not paint a tick mark at the specified value if it wasn't already drawn before.

Definition at line 128 of file KDChartRulerAttributes.cpp.

References d.

00129 {
00130         if ( !d->customTickMarkPens.contains( value ) )
00131                 d->customTickMarkPens.insert( value, pen );
00132 }

void RulerAttributes::setTickMarkPen ( const QPen &  pen  ) 

Sets the pen used to draw the tick marks.

Definition at line 86 of file KDChartRulerAttributes.cpp.

References d.

00087 {
00088         d->tickMarkPen = pen;
00089 }

bool RulerAttributes::showMajorTickMarks (  )  const

Definition at line 176 of file KDChartRulerAttributes.cpp.

References d.

Referenced by KDChart::CartesianAxis::paintCtx().

00177 {
00178     return d->showMajorTickMarks;
00179 }

bool RulerAttributes::showMinorTickMarks (  )  const

Definition at line 186 of file KDChartRulerAttributes.cpp.

References d.

Referenced by KDChart::CartesianAxis::paintCtx().

00187 {
00188     return d->showMinorTickMarks;
00189 }

QColor RulerAttributes::tickMarkColor (  )  const

Definition at line 166 of file KDChartRulerAttributes.cpp.

References d.

00167 {
00168         return d->tickMarkPen.color();
00169 }

QPen RulerAttributes::tickMarkPen ( qreal  value  )  const

Definition at line 134 of file KDChartRulerAttributes.cpp.

References d.

00135 {
00136         QMapIterator<qreal, QPen> it( d->customTickMarkPens );
00137         while( it.hasNext() ) {
00138                 it.next();
00139                 if ( qAbs( value - it.key() ) < std::numeric_limits< float >::epsilon() )
00140                         return it.value();
00141         }
00142         return d->tickMarkPen;
00143 }

QPen RulerAttributes::tickMarkPen (  )  const

Definition at line 91 of file KDChartRulerAttributes.cpp.

References d.

Referenced by operator<<(), operator==(), and KDChart::CartesianAxis::paintCtx().

00092 {
00093         return d->tickMarkPen;
00094 }

RulerAttributes::TickMarkerPensMap RulerAttributes::tickMarkPens (  )  const

Definition at line 145 of file KDChartRulerAttributes.cpp.

References d.

Referenced by operator<<().

00146 {
00147     return d->customTickMarkPens;
00148 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 4 23:26:32 2010 for KD Chart 2 by  doxygen 1.5.4