KDChart::AbstractAxis Class Reference

#include <KDChartAbstractAxis.h>

Inheritance diagram for KDChart::AbstractAxis:

Inheritance graph
[legend]
Collaboration diagram for KDChart::AbstractAxis:

Collaboration graph
[legend]

List of all members.


Detailed Description

The base class for axes.

For being useful, axes need to be assigned to a diagram, see AbstractCartesianDiagram::addAxis and AbstractCartesianDiagram::takeAxis.

See also:
PolarAxis, AbstractCartesianDiagram

Definition at line 64 of file KDChartAbstractAxis.h.


Public Slots

void update ()

Signals

void positionChanged (AbstractArea *)

Public Member Functions

 AbstractAxis (AbstractDiagram *diagram=0)
void alignToReferencePoint (const RelativePosition &position)
BackgroundAttributes backgroundAttributes () const
virtual int bottomOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().
bool compare (const AbstractAreaBase *other) const
 Returns true if both areas have the same settings.
bool compare (const AbstractAxis *other) const
 Returns true if both axes have the same settings.
virtual void connectSignals ()
 Wireing the signal/slot connections.
const AbstractCoordinatePlanecoordinatePlane () const
 Convenience function, returns the coordinate plane, in which this axis is used.
void createObserver (AbstractDiagram *diagram)
virtual const QString customizedLabel (const QString &label) const
 Implement this method if you want to adjust axis labels before they are printed.
void deleteObserver (AbstractDiagram *diagram)
const AbstractDiagramdiagram () const
FrameAttributes frameAttributes () const
virtual QRect geometry () const =0
void getFrameLeadings (int &left, int &top, int &right, int &bottom) const
QStringList labels () const
 Returns a list of strings, that are used as axis labels, as set via setLabels.
virtual int leftOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
bool observedBy (AbstractDiagram *diagram) const
virtual void paint (QPainter *)=0
virtual void paintAll (QPainter &painter)
 Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.
virtual void paintBackground (QPainter &painter, const QRect &rectangle)
virtual void paintCtx (PaintContext *context)
 Default impl: Paint the complete item using its layouted position and size.
virtual void paintFrame (QPainter &painter, const QRect &rectangle)
virtual void paintIntoRect (QPainter &painter, const QRect &rect)
 Draws the background and frame, then calls paint().
QLayout * parentLayout ()
void removeFromParentLayout ()
virtual int rightOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
RulerAttributes rulerAttributes () const
 Returns the attributes to be used for painting the rulers.
void setBackgroundAttributes (const BackgroundAttributes &a)
void setFrameAttributes (const FrameAttributes &a)
virtual void setGeometry (const QRect &rect)=0
void setLabels (const QStringList &list)
 Use this to specify your own set of strings, to be used as axis labels.
void setParentLayout (QLayout *lay)
virtual void setParentWidget (QWidget *widget)
 Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.
void setRulerAttributes (const RulerAttributes &a)
 Use this to specify the attributes used to paint the axis ruler.
void setShortLabels (const QStringList &list)
 Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long.
void setTextAttributes (const TextAttributes &a)
 Use this to specify the text attributes to be used for axis labels.
QStringList shortLabels () const
 Returns a list of strings, that are used as axis labels, as set via setShortLabels.
virtual void sizeHintChanged () const
 Report changed size hint: ask the parent widget to recalculate the layout.
TextAttributes textAttributes () const
 Returns the text attributes to be used for axis labels.
virtual int topOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
virtual ~AbstractAxis ()

Static Public Member Functions

static void paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes)
static void paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes)

Protected Slots

virtual void delayedInit ()
 called for initializing after the c'tor has completed

Protected Member Functions

virtual QRect areaGeometry () const
QRect innerRect () const
virtual void positionHasChanged ()

Protected Attributes

QWidgetmParent
QLayout * mParentLayout

Constructor & Destructor Documentation

AbstractAxis::AbstractAxis ( AbstractDiagram diagram = 0  )  [explicit]

Definition at line 108 of file KDChartAbstractAxis.cpp.

References delayedInit(), and StockDiagram::init().

00109     : AbstractArea( new Private( diagram, this ) )
00110 {
00111     init();
00112     QTimer::singleShot(0, this, SLOT(delayedInit()));
00113 }

AbstractAxis::~AbstractAxis (  )  [virtual]

Definition at line 115 of file KDChartAbstractAxis.cpp.

References d.

00116 {
00117     d->mDiagram = 0;
00118     d->secondaryDiagrams.clear();
00119 }


Member Function Documentation

void AbstractAreaBase::alignToReferencePoint ( const RelativePosition position  )  [inherited]

Definition at line 91 of file KDChartAbstractAreaBase.cpp.

00092 {
00093     Q_UNUSED( position );
00094     // PENDING(kalle) FIXME
00095     qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosition& position )" );
00096 }

QRect AbstractArea::areaGeometry (  )  const [protected, virtual, inherited]

Implements KDChart::AbstractAreaBase.

Definition at line 150 of file KDChartAbstractArea.cpp.

Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::TernaryCoordinatePlane::paint(), KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and KDChart::CartesianAxis::paintCtx().

00151 {
00152     return geometry();
00153 }

BackgroundAttributes AbstractAreaBase::backgroundAttributes (  )  const [inherited]

Definition at line 121 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::compare(), and updateCommonBrush().

00122 {
00123     return d->backgroundAttributes;
00124 }

int AbstractArea::bottomOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the bottom edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 101 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00102 {
00103     // Re-calculate the sizes,
00104     // so we also get the amountOf..Overlap members set newly:
00105     if( ! doNotRecalculate )
00106         sizeHint();
00107     return d->amountOfBottomOverlap;
00108 }

bool AbstractAreaBase::compare ( const AbstractAreaBase other  )  const [inherited]

Returns true if both areas have the same settings.

Definition at line 76 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::backgroundAttributes(), and KDChart::AbstractAreaBase::frameAttributes().

00077 {
00078     if( other == this ) return true;
00079     if( ! other ){
00080         //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer";
00081         return false;
00082     }
00083     /*
00084     qDebug() << "AbstractAreaBase:" << (frameAttributes() == other->frameAttributes())
00085         << (backgroundAttributes() == other->backgroundAttributes()) << "\n";
00086     */
00087     return  (frameAttributes()      == other->frameAttributes()) &&
00088             (backgroundAttributes() == other->backgroundAttributes());
00089 }

bool AbstractAxis::compare ( const AbstractAxis other  )  const

Returns true if both axes have the same settings.

Definition at line 142 of file KDChartAbstractAxis.cpp.

References labels(), shortLabels(), and textAttributes().

00143 {
00144     if( other == this ) return true;
00145     if( ! other ){
00146         //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer";
00147         return false;
00148     }
00149     /*
00150     qDebug() << (textAttributes() == other->textAttributes());
00151     qDebug() << (labels()         == other->labels());
00152     qDebug() << (shortLabels()    == other->shortLabels());
00153     */
00154     return  ( static_cast<const AbstractAreaBase*>(this)->compare( other ) ) &&
00155             (textAttributes() == other->textAttributes()) &&
00156             (labels()         == other->labels()) &&
00157             (shortLabels()    == other->shortLabels());
00158 }

void AbstractAxis::connectSignals (  )  [virtual]

Wireing the signal/slot connections.

This method gets called automatically, each time, when you assign the axis to a diagram, either by passing a diagram* to the c'tor, or by calling the diagram's setAxis method, resp.

If overwriting this method in derived classes, make sure to call this base method AbstractAxis::connectSignals(), so your axis gets connected to the diagram's built-in signals.

See also:
AbstractCartesianDiagram::addAxis()

Definition at line 211 of file KDChartAbstractAxis.cpp.

References d, and update().

Referenced by createObserver().

00212 {
00213     if( d->observer ){
00214         connect( d->observer, SIGNAL( diagramDataChanged( AbstractDiagram *) ),
00215                 this, SLOT( update() ) );
00216     }
00217 }

const AbstractCoordinatePlane * AbstractAxis::coordinatePlane (  )  const

Convenience function, returns the coordinate plane, in which this axis is used.

If the axis is not used in a coordinate plane, the return value is Zero.

Definition at line 349 of file KDChartAbstractAxis.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane().

00350 {
00351     if( d->diagram() )
00352         return d->diagram()->coordinatePlane();
00353     return 0;
00354 }

void AbstractAxis::createObserver ( AbstractDiagram diagram  ) 

Definition at line 177 of file KDChartAbstractAxis.cpp.

References connectSignals(), and d.

Referenced by KDChart::AbstractCartesianDiagram::addAxis().

00178 {
00179     if( d->setDiagram( diagram ) )
00180         connectSignals();
00181 }

const QString AbstractAxis::customizedLabel ( const QString &  label  )  const [virtual]

Implement this method if you want to adjust axis labels before they are printed.

KD Chart is calling this method immediately before drawing the text, this means: What you return here will be drawn without further modifications.

Parameters:
label The text of the label as KD Chart has calculated it automatically (or as it was taken from a QStringList provided by you, resp.)
Returns:
The text to be drawn. By default this is the same as label.

Definition at line 161 of file KDChartAbstractAxis.cpp.

Referenced by KDChart::LeveyJenningsAxis::paintAsOrdinate(), and KDChart::CartesianAxis::paintCtx().

00162 {
00163     return label;
00164 }

void AbstractAxis::delayedInit (  )  [protected, virtual, slot]

called for initializing after the c'tor has completed

Definition at line 134 of file KDChartAbstractAxis.cpp.

References d.

Referenced by AbstractAxis().

00135 {
00136     // We call setDiagram() here, because the c'tor of Private
00137     // only has stored the pointers, but it did not call setDiagram().
00138     if( d )
00139         d->setDiagram( 0, true /* delayedInit */ );
00140 }

void AbstractAxis::deleteObserver ( AbstractDiagram diagram  ) 

Definition at line 193 of file KDChartAbstractAxis.cpp.

References d.

Referenced by KDChart::AbstractCartesianDiagram::takeAxis(), and KDChart::AbstractCartesianDiagram::~AbstractCartesianDiagram().

00194 {
00195     d->unsetDiagram( diagram );
00196 }

const AbstractDiagram * KDChart::AbstractAxis::diagram (  )  const

Definition at line 356 of file KDChartAbstractAxis.cpp.

References d.

Referenced by KDChart::CartesianAxis::paintCtx(), KDChart::CartesianAxis::~CartesianAxis(), and KDChart::LeveyJenningsAxis::~LeveyJenningsAxis().

00357 {
00358     return d->diagram();
00359 }

FrameAttributes AbstractAreaBase::frameAttributes (  )  const [inherited]

Definition at line 107 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::Legend::clone(), KDChart::AbstractAreaBase::compare(), and updateCommonBrush().

00108 {
00109     return d->frameAttributes;
00110 }

virtual QRect KDChart::AbstractAxis::geometry (  )  const [pure virtual]

Implemented in KDChart::CartesianAxis, and KDChart::TernaryAxis.

void AbstractAreaBase::getFrameLeadings ( int &  left,
int &  top,
int &  right,
int &  bottom 
) const [inherited]

Definition at line 213 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().

00214 {
00215     if( d && d->frameAttributes.isVisible() ){
00216         const int padding = qMax( d->frameAttributes.padding(), 0 );
00217         left   = padding;
00218         top    = padding;
00219         right  = padding;
00220         bottom = padding;
00221     }else{
00222         left   = 0;
00223         top    = 0;
00224         right  = 0;
00225         bottom = 0;
00226     }
00227 }

QRect AbstractAreaBase::innerRect (  )  const [protected, inherited]

Definition at line 229 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings().

Referenced by KDChart::TextArea::paintAll(), and KDChart::AbstractArea::paintAll().

00230 {
00231     int left;
00232     int top;
00233     int right;
00234     int bottom;
00235     getFrameLeadings( left, top, right, bottom );
00236     return
00237         QRect( QPoint(0,0), areaGeometry().size() )
00238             .adjusted( left, top, -right, -bottom );
00239 }

QStringList AbstractAxis::labels (  )  const

Returns a list of strings, that are used as axis labels, as set via setLabels.

See also:
setLabels

Definition at line 306 of file KDChartAbstractAxis.cpp.

References d.

Referenced by compare(), KDChart::LeveyJenningsAxis::paintAsOrdinate(), KDChart::TernaryAxis::paintCtx(), and KDChart::CartesianAxis::paintCtx().

00307 {
00308     return d->hardLabels;
00309 }

int AbstractArea::leftOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the left edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 77 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00078 {
00079     // Re-calculate the sizes,
00080     // so we also get the amountOf..Overlap members set newly:
00081     if( ! doNotRecalculate )
00082         sizeHint();
00083     return d->amountOfLeftOverlap;
00084 }

bool KDChart::AbstractAxis::observedBy ( AbstractDiagram diagram  )  const

Definition at line 361 of file KDChartAbstractAxis.cpp.

References d.

00362 {
00363     return d->hasDiagram( diagram );
00364 }

virtual void KDChart::AbstractLayoutItem::paint ( QPainter *   )  [pure virtual, inherited]

Implemented in KDChart::CartesianAxis, KDChart::CartesianCoordinatePlane, KDChart::TextLayoutItem, KDChart::TextBubbleLayoutItem, KDChart::MarkerLayoutItem, KDChart::LineLayoutItem, KDChart::LineWithMarkerLayoutItem, KDChart::HorizontalLineLayoutItem, KDChart::VerticalLineLayoutItem, KDChart::AutoSpacerLayoutItem, KDChart::PolarCoordinatePlane, KDChart::TernaryAxis, and KDChart::TernaryCoordinatePlane.

Referenced by KDChart::Legend::paint(), KDChart::AbstractLayoutItem::paintAll(), KDChart::AbstractArea::paintAll(), and KDChart::AbstractLayoutItem::paintCtx().

void AbstractArea::paintAll ( QPainter &  painter  )  [virtual, inherited]

Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.

Reimplemented from KDChart::AbstractLayoutItem.

Reimplemented in KDChart::TernaryAxis.

Definition at line 123 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::areaGeometry(), d, KDChart::AbstractAreaBase::innerRect(), KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and KDChart::AbstractAreaBase::paintFrame().

Referenced by KDChart::AbstractArea::paintIntoRect().

00124 {
00125     // Paint the background and frame
00126     const QRect overlappingArea( geometry().adjusted(
00127             -d->amountOfLeftOverlap,
00128             -d->amountOfTopOverlap,
00129             d->amountOfRightOverlap,
00130             d->amountOfBottomOverlap ) );
00131     paintBackground( painter, overlappingArea );
00132     paintFrame(      painter, overlappingArea );
00133 
00134     // temporarily adjust the widget size, to be sure all content gets calculated
00135     // to fit into the inner rectangle
00136     const QRect oldGeometry( areaGeometry()  );
00137     QRect inner( innerRect() );
00138     inner.moveTo(
00139         oldGeometry.left() + inner.left(),
00140         oldGeometry.top()  + inner.top() );
00141     const bool needAdjustGeometry = oldGeometry != inner;
00142     if( needAdjustGeometry )
00143         setGeometry( inner );
00144     paint( &painter );
00145     if( needAdjustGeometry )
00146         setGeometry( oldGeometry );
00147     //qDebug() << "AbstractAreaWidget::paintAll() done.";
00148 }

void AbstractAreaBase::paintBackground ( QPainter &  painter,
const QRect &  rectangle 
) [virtual, inherited]

Definition at line 197 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes().

Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00198 {
00199     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
00200                 "Private class was not initialized!" );
00201     paintBackgroundAttributes( painter, rect, d->backgroundAttributes );
00202 }

void AbstractAreaBase::paintBackgroundAttributes ( QPainter &  painter,
const QRect &  rectangle,
const KDChart::BackgroundAttributes attributes 
) [static, inherited]

Definition at line 128 of file KDChartAbstractAreaBase.cpp.

References KDChart::BackgroundAttributes::BackgroundPixmapModeCentered, KDChart::BackgroundAttributes::BackgroundPixmapModeNone, KDChart::BackgroundAttributes::BackgroundPixmapModeScaled, KDChart::BackgroundAttributes::BackgroundPixmapModeStretched, KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), m, KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode().

Referenced by KDChart::AbstractAreaBase::paintBackground().

00130 {
00131     if( !attributes.isVisible() ) return;
00132 
00133     /* first draw the brush (may contain a pixmap)*/
00134     if( Qt::NoBrush != attributes.brush().style() ) {
00135         KDChart::PainterSaver painterSaver( &painter );
00136         painter.setPen( Qt::NoPen );
00137         const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
00138         painter.setBrushOrigin( newTopLeft );
00139         painter.setBrush( attributes.brush() );
00140         painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00141     }
00142     /* next draw the backPixmap over the brush */
00143     if( !attributes.pixmap().isNull() &&
00144         attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
00145         QPointF ol = rect.topLeft();
00146         if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
00147         {
00148             ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
00149             ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
00150             painter.drawPixmap( ol, attributes.pixmap() );
00151         } else {
00152             QMatrix m;
00153             double zW = (double)rect.width()  / (double)attributes.pixmap().width();
00154             double zH = (double)rect.height() / (double)attributes.pixmap().height();
00155             switch( attributes.pixmapMode() ) {
00156             case BackgroundAttributes::BackgroundPixmapModeScaled:
00157             {
00158                 double z;
00159                 z = qMin( zW, zH );
00160                 m.scale( z, z );
00161             }
00162             break;
00163             case BackgroundAttributes::BackgroundPixmapModeStretched:
00164                 m.scale( zW, zH );
00165                 break;
00166             default:
00167                 ; // Cannot happen, previously checked
00168             }
00169             QPixmap pm = attributes.pixmap().transformed( m );
00170             ol.setX( rect.center().x() - pm.width() / 2 );
00171             ol.setY( rect.center().y() - pm.height()/ 2 );
00172             painter.drawPixmap( ol, pm );
00173         }
00174     }
00175 }

void KDChart::AbstractLayoutItem::paintCtx ( PaintContext context  )  [virtual, inherited]

Default impl: Paint the complete item using its layouted position and size.

Reimplemented in KDChart::CartesianAxis, KDChart::LeveyJenningsAxis, and KDChart::TernaryAxis.

Definition at line 78 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().

00079 {
00080     if( context )
00081         paint( context->painter() );
00082 }

void AbstractAreaBase::paintFrame ( QPainter &  painter,
const QRect &  rectangle 
) [virtual, inherited]

Definition at line 205 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintFrameAttributes().

Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00206 {
00207     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
00208                 "Private class was not initialized!" );
00209     paintFrameAttributes( painter, rect, d->frameAttributes );
00210 }

void AbstractAreaBase::paintFrameAttributes ( QPainter &  painter,
const QRect &  rectangle,
const KDChart::FrameAttributes attributes 
) [static, inherited]

Definition at line 178 of file KDChartAbstractAreaBase.cpp.

References KDChart::FrameAttributes::isVisible(), KDChart::FrameAttributes::pen(), and KDChart::PrintingParameters::scalePen().

Referenced by KDChart::AbstractAreaBase::paintFrame().

00180 {
00181 
00182     if( !attributes.isVisible() ) return;
00183 
00184     // Note: We set the brush to NoBrush explicitly here.
00185     //       Otherwise we might get a filled rectangle, so any
00186     //       previously drawn background would be overwritten by that area.
00187 
00188     const QPen   oldPen(   painter.pen() );
00189     const QBrush oldBrush( painter.brush() );
00190     painter.setPen(  PrintingParameters::scalePen( attributes.pen() ) );
00191     painter.setBrush( Qt::NoBrush );
00192     painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00193     painter.setBrush( oldBrush );
00194     painter.setPen( oldPen );
00195 }

void AbstractArea::paintIntoRect ( QPainter &  painter,
const QRect &  rect 
) [virtual, inherited]

Draws the background and frame, then calls paint().

In most cases there is no need to overwrite this method in a derived class, but you would overwrite AbstractLayoutItem::paint() instead.

Definition at line 111 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::paintAll().

00112 {
00113     const QRect oldGeometry( geometry() );
00114     if( oldGeometry != rect )
00115         setGeometry( rect );
00116     painter.translate( rect.left(), rect.top() );
00117     paintAll( painter );
00118     painter.translate( -rect.left(), -rect.top() );
00119     if( oldGeometry != rect )
00120         setGeometry( oldGeometry );
00121 }

QLayout* KDChart::AbstractLayoutItem::parentLayout (  )  [inherited]

Definition at line 79 of file KDChartLayoutItems.h.

00080         {
00081             return mParentLayout;
00082         }

void KDChart::AbstractArea::positionChanged ( AbstractArea  )  [signal, inherited]

Referenced by KDChart::AbstractArea::positionHasChanged().

void AbstractArea::positionHasChanged (  )  [protected, virtual, inherited]

Reimplemented from KDChart::AbstractAreaBase.

Definition at line 155 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::positionChanged().

00156 {
00157     emit positionChanged( this );
00158 }

void KDChart::AbstractLayoutItem::removeFromParentLayout (  )  [inherited]

Definition at line 83 of file KDChartLayoutItems.h.

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

00084         {
00085             if( mParentLayout ){
00086                 if( widget() )
00087                     mParentLayout->removeWidget( widget() );
00088                 else
00089                     mParentLayout->removeItem( this );
00090             }
00091         }

int AbstractArea::rightOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the right edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 85 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00086 {
00087     // Re-calculate the sizes,
00088     // so we also get the amountOf..Overlap members set newly:
00089     if( ! doNotRecalculate )
00090         sizeHint();
00091     return d->amountOfRightOverlap;
00092 }

RulerAttributes AbstractAxis::rulerAttributes (  )  const

Returns the attributes to be used for painting the rulers.

See also:
setRulerAttributes

Definition at line 270 of file KDChartAbstractAxis.cpp.

References d.

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

00271 {
00272         return d->rulerAttributes;
00273 }

void AbstractAreaBase::setBackgroundAttributes ( const BackgroundAttributes a  )  [inherited]

Definition at line 112 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::positionHasChanged().

00113 {
00114     if( d->backgroundAttributes == a )
00115         return;
00116 
00117     d->backgroundAttributes = a;
00118     positionHasChanged();
00119 }

void AbstractAreaBase::setFrameAttributes ( const FrameAttributes a  )  [inherited]

Definition at line 98 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::positionHasChanged().

Referenced by KDChart::Legend::clone().

00099 {
00100     if( d->frameAttributes == a )
00101         return;
00102 
00103     d->frameAttributes = a;
00104     positionHasChanged();
00105 }

virtual void KDChart::AbstractAxis::setGeometry ( const QRect &  rect  )  [pure virtual]

Implemented in KDChart::CartesianAxis, and KDChart::TernaryAxis.

void AbstractAxis::setLabels ( const QStringList &  list  ) 

Use this to specify your own set of strings, to be used as axis labels.

Labels specified via setLabels take precedence: If a non-empty list is passed, KD Chart will use these strings as axis labels, instead of calculating them.

If you a smaller number of strings than the number of labels drawn at this axis, KD Chart will iterate over the list, repeating the strings, until all labels are drawn. As an example you could specify the seven days of the week as abscissa labels, which would be repeatedly used then.

By passing an empty QStringList you can reset the default behaviour.

See also:
labels, setShortLabels

Definition at line 292 of file KDChartAbstractAxis.cpp.

References d, and update().

Referenced by KDChart::LeveyJenningsAxis::paintAsAbscissa().

00293 {
00294     if( d->hardLabels == list )
00295         return;
00296 
00297     d->hardLabels = list;
00298     update();
00299 }

void KDChart::AbstractLayoutItem::setParentLayout ( QLayout *  lay  )  [inherited]

Definition at line 75 of file KDChartLayoutItems.h.

00076         {
00077             mParentLayout = lay;
00078         }

void KDChart::AbstractLayoutItem::setParentWidget ( QWidget widget  )  [virtual, inherited]

Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.

Thus, you need to call setParentWidget on every item, that has a non-fixed size.

Definition at line 65 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::HeaderFooter::setParent(), and KDChart::AbstractCartesianDiagram::takeAxis().

00066 {
00067     mParent = widget;
00068 }

void AbstractAxis::setRulerAttributes ( const RulerAttributes a  ) 

Use this to specify the attributes used to paint the axis ruler.

Every axis has a default set of ruler attributes that is exactly the same among them. Use this method to specify your own attributes.

See also:
rulerAttributes

Definition at line 259 of file KDChartAbstractAxis.cpp.

References d, and update().

00260 {
00261         d->rulerAttributes = a;
00262         update();
00263 }

void AbstractAxis::setShortLabels ( const QStringList &  list  ) 

Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long.

Note:
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via setLabels too!
By passing an empty QStringList you can reset the default behaviour.

See also:
shortLabels, setLabels

Definition at line 322 of file KDChartAbstractAxis.cpp.

References d, and update().

00323 {
00324     if( d->hardShortLabels == list )
00325         return;
00326 
00327     d->hardShortLabels = list;
00328     update();
00329 }

void AbstractAxis::setTextAttributes ( const TextAttributes a  ) 

Use this to specify the text attributes to be used for axis labels.

By default, the reference area will be set at painting time. It will be the then-valid coordinate plane's parent widget, so normally, it will be the KDChart::Chart. Thus the labels of all of your axes in all of your diagrams within that Chart will be drawn in same font size, by default.

See also:
textAttributes, setLabels

Definition at line 231 of file KDChartAbstractAxis.cpp.

References d, and update().

Referenced by KDChart::LeveyJenningsAxis::setType().

00232 {
00233     if( d->textAttributes == a )
00234         return;
00235 
00236     d->textAttributes = a;
00237     update();
00238 }

QStringList AbstractAxis::shortLabels (  )  const

Returns a list of strings, that are used as axis labels, as set via setShortLabels.

Note:
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via setLabels too!
See also:
setShortLabels

Definition at line 339 of file KDChartAbstractAxis.cpp.

References d.

Referenced by compare(), and KDChart::CartesianAxis::paintCtx().

00340 {
00341     return d->hardShortLabels;
00342 }

void KDChart::AbstractLayoutItem::sizeHintChanged (  )  const [virtual, inherited]

Report changed size hint: ask the parent widget to recalculate the layout.

Definition at line 87 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::TextLayoutItem::sizeHintAndRotatedCorners().

00088 {
00089     // This is exactly like what QWidget::updateGeometry does.
00090 //  qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
00091     if( mParent ) {
00092         if ( mParent->layout() )
00093             mParent->layout()->invalidate();
00094         else
00095             QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
00096     }
00097 }

TextAttributes AbstractAxis::textAttributes (  )  const

Returns the text attributes to be used for axis labels.

See also:
setTextAttributes

Definition at line 245 of file KDChartAbstractAxis.cpp.

References d.

Referenced by compare(), KDChart::LeveyJenningsAxis::paintAsAbscissa(), KDChart::LeveyJenningsAxis::paintAsOrdinate(), KDChart::CartesianAxis::paintCtx(), KDChart::LeveyJenningsAxis::setType(), and KDChart::CartesianAxis::titleTextAttributes().

00246 {
00247     return d->textAttributes;
00248 }

int AbstractArea::topOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the top edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 93 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00094 {
00095     // Re-calculate the sizes,
00096     // so we also get the amountOf..Overlap members set newly:
00097     if( ! doNotRecalculate )
00098         sizeHint();
00099     return d->amountOfTopOverlap;
00100 }

void KDChart::AbstractAxis::update (  )  [slot]

Definition at line 366 of file KDChartAbstractAxis.cpp.

References d.

Referenced by connectSignals(), KDChart::CartesianAxis::setAnnotations(), setLabels(), setRulerAttributes(), setShortLabels(), and setTextAttributes().

00367 {
00368     if( d->diagram() )
00369         d->diagram()->update();
00370 }


Member Data Documentation

QWidget* KDChart::AbstractLayoutItem::mParent [protected, inherited]

Definition at line 93 of file KDChartLayoutItems.h.

Referenced by KDChart::AbstractLayoutItem::setParentWidget(), KDChart::TextLayoutItem::setText(), KDChart::TextLayoutItem::setTextAlignment(), KDChart::TextLayoutItem::setTextAttributes(), and KDChart::AbstractLayoutItem::sizeHintChanged().

QLayout* KDChart::AbstractLayoutItem::mParentLayout [protected, inherited]

Definition at line 94 of file KDChartLayoutItems.h.

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


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