KDChart::GlobalMeasureScaling Class Reference

#include <KDChartMeasure.h>

Collaboration diagram for KDChart::GlobalMeasureScaling:

Collaboration graph
[legend]

List of all members.


Detailed Description

Auxiliary class used by the KDChart::Measure and KDChart::Chart class.

Normally there should be no need to call any of these methods yourself.

They are used by KDChart::Chart::paint( QPainter*, const QRect& ) to adjust all of the relative Measures according to the target rectangle's size.

Default factors are (1.0, 1.0)

Definition at line 149 of file KDChartMeasure.h.


Public Member Functions

 GlobalMeasureScaling ()
virtual ~GlobalMeasureScaling ()

Static Public Member Functions

static const QPair< qreal, qreal > currentFactors ()
 Returns the currently active factors.
static GlobalMeasureScalinginstance ()
static QPaintDevicepaintDevice ()
 Returns the paint device usable for calculating fort metrics.
static void resetFactors ()
 Reset factors to the values active before the previous call of setFactors.
static void setFactors (qreal factorX, qreal factorY)
 Set new factors to be used by all Measure objects from now on.
static void setPaintDevice (QPaintDevice *paintDevice)
 Sets the paint device usable for calculating fort metrics.

Constructor & Destructor Documentation

KDChart::GlobalMeasureScaling::GlobalMeasureScaling (  ) 

Definition at line 194 of file KDChartMeasure.cpp.

00195 {
00196     mFactors.push( qMakePair(qreal(1.0), qreal(1.0)) );
00197 }

KDChart::GlobalMeasureScaling::~GlobalMeasureScaling (  )  [virtual]

Definition at line 199 of file KDChartMeasure.cpp.

00200 {
00201     // this space left empty intentionally
00202 }


Member Function Documentation

const QPair< qreal, qreal > KDChart::GlobalMeasureScaling::currentFactors (  )  [static]

Returns the currently active factors.

Definition at line 222 of file KDChartMeasure.cpp.

References instance(), and mFactors.

Referenced by KDChart::Measure::sizeOfArea().

00223 {
00224     return instance()->mFactors.top();
00225 }

GlobalMeasureScaling * KDChart::GlobalMeasureScaling::instance (  )  [static]

Definition at line 204 of file KDChartMeasure.cpp.

Referenced by currentFactors(), KDChart::Chart::paint(), paintDevice(), resetFactors(), setFactors(), setPaintDevice(), and KDChart::Measure::sizeOfArea().

00205 {
00206     static GlobalMeasureScaling instance;
00207     return &instance;
00208 }

QPaintDevice * KDChart::GlobalMeasureScaling::paintDevice (  )  [static]

Returns the paint device usable for calculating fort metrics.

Definition at line 232 of file KDChartMeasure.cpp.

References instance(), and m_paintDevice.

Referenced by KDChart::Chart::paint(), and KDChart::CartesianAxis::paintCtx().

00233 {
00234     return instance()->m_paintDevice;
00235 }

void KDChart::GlobalMeasureScaling::resetFactors (  )  [static]

Reset factors to the values active before the previous call of setFactors.

This works on a stack, so recursive calls works fine, like: setFactors, setFactors, unserFactors, unsetFactors

Definition at line 215 of file KDChartMeasure.cpp.

References instance(), and mFactors.

Referenced by KDChart::Chart::paint().

00216 {
00217     // never remove the initial (1.0. 1.0) setting
00218     if( instance()->mFactors.count() > 1 )
00219         instance()->mFactors.pop();
00220 }

void KDChart::GlobalMeasureScaling::setFactors ( qreal  factorX,
qreal  factorY 
) [static]

Set new factors to be used by all Measure objects from now on.

Previous values will be stored.

Definition at line 210 of file KDChartMeasure.cpp.

References instance(), and mFactors.

Referenced by KDChart::Chart::paint().

00211 {
00212     instance()->mFactors.push( qMakePair(factorX, factorY) );
00213 }

void KDChart::GlobalMeasureScaling::setPaintDevice ( QPaintDevice paintDevice  )  [static]

Sets the paint device usable for calculating fort metrics.

Definition at line 227 of file KDChartMeasure.cpp.

References instance(), and m_paintDevice.

Referenced by KDChart::Chart::paint().

00228 {
00229     instance()->m_paintDevice = paintDevice;
00230 }


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