#include <KDChartAbstractCoordinatePlane.h>
Inheritance diagram for KDChart::AbstractCoordinatePlane:
Definition at line 47 of file KDChartAbstractCoordinatePlane.h.
Public Types | |
enum | AxesCalcMode { Linear, Logarithmic } |
Public Slots | |
void | layoutPlanes () |
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes(). | |
void | relayout () |
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout(). | |
void | setGridNeedsRecalculate () |
Used by the chart to clear the cached grid data. | |
void | update () |
Calling update() on the plane triggers the global KDChart::Chart::update(). | |
Signals | |
void | destroyedCoordinatePlane (AbstractCoordinatePlane *) |
Emitted when this coordinate plane is destroyed. | |
void | needLayoutPlanes () |
Emitted when plane needs to trigger the Chart's layouting of the coord. | |
void | needRelayout () |
Emitted when plane needs to trigger the Chart's layouting. | |
void | needUpdate () |
Emitted when plane needs to update its drawings. | |
void | positionChanged (AbstractArea *) |
void | propertiesChanged () |
Emitted upon change of a property of the Coordinate Plane or any of its components. | |
Public Member Functions | |
virtual void | addDiagram (AbstractDiagram *diagram) |
Adds a diagram to this coordinate plane. | |
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. | |
AbstractDiagram * | diagram () |
| |
ConstAbstractDiagramList | diagrams () const |
| |
AbstractDiagramList | diagrams () |
| |
virtual Qt::Orientations | expandingDirections () const |
pure virtual in QLayoutItem | |
FrameAttributes | frameAttributes () const |
virtual QRect | geometry () const |
pure virtual in QLayoutItem | |
void | getFrameLeadings (int &left, int &top, int &right, int &bottom) const |
GridAttributes | globalGridAttributes () const |
| |
DataDimensionsList | gridDimensionsList () |
Returns the dimensions used for drawing the grid lines. | |
virtual bool | isEmpty () const |
pure virtual in QLayoutItem | |
bool | isRubberBandZoomingEnabled () const |
| |
const bool | isVisiblePoint (const QPointF &point) const |
Tests, if a point is visible on the coordinate plane. | |
virtual void | layoutDiagrams ()=0 |
Distribute the available space among the diagrams and axes. | |
virtual int | leftOverlap (bool doNotRecalculate=false) const |
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint(). | |
virtual QSize | maximumSize () const |
pure virtual in QLayoutItem | |
virtual QSize | minimumSize () const |
pure virtual in QLayoutItem | |
virtual QSize | minimumSizeHint () const |
[reimplemented] | |
void | mouseDoubleClickEvent (QMouseEvent *event) |
void | mouseMoveEvent (QMouseEvent *event) |
void | mousePressEvent (QMouseEvent *event) |
void | mouseReleaseEvent (QMouseEvent *event) |
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(). | |
const Chart * | parent () const |
Chart * | parent () |
QLayout * | parentLayout () |
AbstractCoordinatePlane * | referenceCoordinatePlane () const |
There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The first is the reference plane. | |
void | removeFromParentLayout () |
virtual void | replaceDiagram (AbstractDiagram *diagram, AbstractDiagram *oldDiagram=0) |
Replaces the old diagram, or appends the diagram, it there is none yet. | |
virtual int | rightOverlap (bool doNotRecalculate=false) const |
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint(). | |
void | setBackgroundAttributes (const BackgroundAttributes &a) |
void | setFrameAttributes (const FrameAttributes &a) |
virtual void | setGeometry (const QRect &r) |
pure virtual in QLayoutItem | |
void | setGlobalGridAttributes (const GridAttributes &) |
Set the grid attributes to be used by this coordinate plane. | |
void | setParent (Chart *parent) |
Called internally by KDChart::Chart. | |
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 | setReferenceCoordinatePlane (AbstractCoordinatePlane *plane) |
Set another coordinate plane to be used as the reference plane for this one. | |
void | setRubberBandZoomingEnabled (bool enable) |
Enables or disables zooming with a rubber band using the mouse. | |
virtual void | setZoomCenter (const QPointF ¢er) |
Set the point (in value coordinates) to be used as the center point in zoom operations. | |
virtual void | setZoomFactorX (double factor) |
Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations. | |
virtual void | setZoomFactorY (double factor) |
Sets the zoom factor in vertical direction, that is applied to all coordinate transformations. | |
virtual AbstractCoordinatePlane * | sharedAxisMasterPlane (QPainter *p=0) |
virtual QSize | sizeHint () const |
pure virtual in QLayoutItem | |
virtual void | sizeHintChanged () const |
Report changed size hint: ask the parent widget to recalculate the layout. | |
virtual QSizePolicy | sizePolicy () const |
[reimplemented] | |
virtual void | takeDiagram (AbstractDiagram *diagram) |
Removes the diagram from the plane, without deleting it. | |
virtual int | topOverlap (bool doNotRecalculate=false) const |
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint(). | |
virtual const QPointF | translate (const QPointF &diagramPoint) const=0 |
Translate the given point in value space coordinates to a position in pixel space. | |
virtual QPointF | zoomCenter () const |
| |
virtual double | zoomFactorX () const |
| |
virtual double | zoomFactorY () const |
| |
virtual | ~AbstractCoordinatePlane () |
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 Member Functions | |
AbstractCoordinatePlane (Chart *parent=0) | |
virtual QRect | areaGeometry () const |
virtual DataDimensionsList | getDataDimensionsList () const=0 |
QRect | innerRect () const |
virtual void | positionHasChanged () |
Protected Attributes | |
QWidget * | mParent |
QLayout * | mParentLayout |
AbstractCoordinatePlane::AbstractCoordinatePlane | ( | Chart * | parent = 0 |
) | [explicit, protected] |
Definition at line 55 of file KDChartAbstractCoordinatePlane.cpp.
00056 : AbstractArea ( new Private() ) 00057 { 00058 d->parent = parent; 00059 d->init(); 00060 }
AbstractCoordinatePlane::~AbstractCoordinatePlane | ( | ) | [virtual] |
Definition at line 62 of file KDChartAbstractCoordinatePlane.cpp.
References destroyedCoordinatePlane().
00063 { 00064 emit destroyedCoordinatePlane( this ); 00065 }
void AbstractCoordinatePlane::addDiagram | ( | AbstractDiagram * | diagram | ) | [virtual] |
Adds a diagram to this coordinate plane.
diagram | The diagram to add. |
Reimplemented in KDChart::CartesianCoordinatePlane, KDChart::PolarCoordinatePlane, and KDChart::TernaryCoordinatePlane.
Definition at line 72 of file KDChartAbstractCoordinatePlane.cpp.
References d, diagram(), layoutDiagrams(), layoutPlanes(), KDChart::AbstractDiagram::setCoordinatePlane(), and update().
Referenced by KDChart::TernaryCoordinatePlane::addDiagram(), KDChart::PolarCoordinatePlane::addDiagram(), KDChart::CartesianCoordinatePlane::addDiagram(), and replaceDiagram().
00073 { 00074 // diagrams are invisible and paint through their paint() method 00075 diagram->hide(); 00076 00077 d->diagrams.append( diagram ); 00078 diagram->setParent( d->parent ); 00079 diagram->setCoordinatePlane( this ); 00080 layoutDiagrams(); 00081 layoutPlanes(); // there might be new axes, etc 00082 update(); 00083 }
void AbstractAreaBase::alignToReferencePoint | ( | const RelativePosition & | position | ) | [inherited] |
Definition at line 90 of file KDChartAbstractAreaBase.cpp.
00091 { 00092 Q_UNUSED( position ); 00093 // PENDING(kalle) FIXME 00094 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosition& position )" ); 00095 }
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().
BackgroundAttributes AbstractAreaBase::backgroundAttributes | ( | ) | const [inherited] |
Definition at line 120 of file KDChartAbstractAreaBase.cpp.
References d.
Referenced by KDChart::AbstractAreaBase::compare(), and updateCommonBrush().
00121 { 00122 return d->backgroundAttributes; 00123 }
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.
Definition at line 101 of file KDChartAbstractArea.cpp.
References d.
Referenced by KDChart::CartesianAxis::maximumSize().
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 75 of file KDChartAbstractAreaBase.cpp.
References KDChart::AbstractAreaBase::backgroundAttributes(), and KDChart::AbstractAreaBase::frameAttributes().
00076 { 00077 if( other == this ) return true; 00078 if( ! other ){ 00079 //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer"; 00080 return false; 00081 } 00082 /* 00083 qDebug() << "AbstractAreaBase:" << (frameAttributes() == other->frameAttributes()) 00084 << (backgroundAttributes() == other->backgroundAttributes()) << "\n"; 00085 */ 00086 return (frameAttributes() == other->frameAttributes()) && 00087 (backgroundAttributes() == other->backgroundAttributes()); 00088 }
void KDChart::AbstractCoordinatePlane::destroyedCoordinatePlane | ( | AbstractCoordinatePlane * | ) | [signal] |
AbstractDiagram * AbstractCoordinatePlane::diagram | ( | ) |
Definition at line 117 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::TernaryCoordinatePlane::addDiagram(), KDChart::PolarCoordinatePlane::addDiagram(), KDChart::CartesianCoordinatePlane::addDiagram(), addDiagram(), KDChart::Widget::diagram(), KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), replaceDiagram(), KDChart::CartesianCoordinatePlane::setGeometry(), KDChart::PolarCoordinatePlane::setStartPosition(), KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane(), and takeDiagram().
00118 { 00119 if ( d->diagrams.isEmpty() ) 00120 { 00121 return 0; 00122 } else { 00123 return d->diagrams.first(); 00124 } 00125 }
ConstAbstractDiagramList AbstractCoordinatePlane::diagrams | ( | ) | const |
Definition at line 132 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00133 { 00134 ConstAbstractDiagramList list; 00135 #ifndef QT_NO_STL 00136 qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) ); 00137 #else 00138 Q_FOREACH( AbstractDiagram * a, d->diagrams ) 00139 list.push_back( a ); 00140 #endif 00141 return list; 00142 }
AbstractDiagramList AbstractCoordinatePlane::diagrams | ( | ) |
Definition at line 127 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), KDChart::Chart::mouseDoubleClickEvent(), KDChart::Chart::mouseMoveEvent(), KDChart::Chart::mousePressEvent(), KDChart::Chart::mouseReleaseEvent(), KDChart::TernaryCoordinatePlane::paint(), KDChart::PolarCoordinatePlane::paint(), KDChart::CartesianCoordinatePlane::paint(), and KDChart::CartesianCoordinatePlane::setGeometry().
00128 { 00129 return d->diagrams; 00130 }
Qt::Orientations KDChart::AbstractCoordinatePlane::expandingDirections | ( | ) | const [virtual] |
FrameAttributes AbstractAreaBase::frameAttributes | ( | ) | const [inherited] |
Definition at line 106 of file KDChartAbstractAreaBase.cpp.
References d.
Referenced by KDChart::Legend::clone(), KDChart::AbstractAreaBase::compare(), and updateCommonBrush().
00107 { 00108 return d->frameAttributes; 00109 }
QRect KDChart::AbstractCoordinatePlane::geometry | ( | ) | const [virtual] |
pure virtual in QLayoutItem
Definition at line 246 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::Chart::mouseDoubleClickEvent(), KDChart::Chart::mouseMoveEvent(), mouseMoveEvent(), KDChart::Chart::mousePressEvent(), KDChart::Chart::mouseReleaseEvent(), mouseReleaseEvent(), and KDChart::PolarCoordinatePlane::paint().
00247 { 00248 return d->geometry; 00249 }
virtual DataDimensionsList KDChart::AbstractCoordinatePlane::getDataDimensionsList | ( | ) | const [protected, pure virtual] |
Implemented in KDChart::CartesianCoordinatePlane, KDChart::PolarCoordinatePlane, and KDChart::TernaryCoordinatePlane.
void AbstractAreaBase::getFrameLeadings | ( | int & | left, | |
int & | top, | |||
int & | right, | |||
int & | bottom | |||
) | const [inherited] |
Definition at line 212 of file KDChartAbstractAreaBase.cpp.
References d.
Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().
00213 { 00214 if( d && d->frameAttributes.isVisible() ){ 00215 const int padding = qMax( d->frameAttributes.padding(), 0 ); 00216 left = padding; 00217 top = padding; 00218 right = padding; 00219 bottom = padding; 00220 }else{ 00221 left = 0; 00222 top = 0; 00223 right = 0; 00224 bottom = 0; 00225 } 00226 }
GridAttributes KDChart::AbstractCoordinatePlane::globalGridAttributes | ( | ) | const |
Definition at line 161 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::PolarCoordinatePlane::gridAttributes(), and KDChart::CartesianCoordinatePlane::gridAttributes().
00162 { 00163 return d->gridAttributes; 00164 }
KDChart::DataDimensionsList KDChart::AbstractCoordinatePlane::gridDimensionsList | ( | ) |
Returns the dimensions used for drawing the grid lines.
Returned data is the result of (cached) grid calculations, so - if you need that information for your own tasks - make sure to call again this function after every data modification that has changed the data range, since grid calculation is based upon the data range, thus the grid start/end might have changed if the data was changed.
Definition at line 166 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::CartesianAxis::maximumSize().
00167 { 00168 //KDChart::DataDimensionsList l( d->grid->updateData( this ) ); 00169 //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() Y-range:" << l.last().end - l.last().start << " step width:" << l.last().stepWidth; 00170 //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() X-range:" << l.first().end - l.first().start << " step width:" << l.first().stepWidth; 00171 return d->grid->updateData( this ); 00172 }
QRect AbstractAreaBase::innerRect | ( | ) | const [protected, inherited] |
Definition at line 228 of file KDChartAbstractAreaBase.cpp.
References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings().
Referenced by KDChart::TextArea::paintAll(), and KDChart::AbstractArea::paintAll().
00229 { 00230 int left; 00231 int top; 00232 int right; 00233 int bottom; 00234 getFrameLeadings( left, top, right, bottom ); 00235 return 00236 QRect( QPoint(0,0), areaGeometry().size() ) 00237 .adjusted( left, top, -right, -bottom ); 00238 }
bool KDChart::AbstractCoordinatePlane::isEmpty | ( | ) | const [virtual] |
pure virtual in QLayoutItem
Definition at line 205 of file KDChartAbstractCoordinatePlane.cpp.
Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams().
00206 { 00207 return false; // never empty! 00208 // coordinate planes with no associated diagrams 00209 // are showing a default grid of ()1..10, 1..10) stepWidth 1 00210 }
bool KDChart::AbstractCoordinatePlane::isRubberBandZoomingEnabled | ( | ) | const |
Definition at line 280 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00281 { 00282 return d->enableRubberBandZooming; 00283 }
const bool KDChart::AbstractCoordinatePlane::isVisiblePoint | ( | const QPointF & | point | ) | const |
Tests, if a point is visible on the coordinate plane.
Definition at line 403 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00404 { 00405 return d->isVisiblePoint( this, point ); 00406 }
virtual void KDChart::AbstractCoordinatePlane::layoutDiagrams | ( | ) | [pure virtual] |
Distribute the available space among the diagrams and axes.
Implemented in KDChart::CartesianCoordinatePlane, KDChart::PolarCoordinatePlane, and KDChart::TernaryCoordinatePlane.
Referenced by addDiagram(), replaceDiagram(), and takeDiagram().
void KDChart::AbstractCoordinatePlane::layoutPlanes | ( | ) | [slot] |
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
Definition at line 263 of file KDChartAbstractCoordinatePlane.cpp.
References needLayoutPlanes().
Referenced by addDiagram(), KDChart::CartesianAxis::layoutPlanes(), KDChart::AbstractCartesianDiagram::layoutPlanes(), and replaceDiagram().
00264 { 00265 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called"); 00266 emit needLayoutPlanes(); 00267 }
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.
Definition at line 77 of file KDChartAbstractArea.cpp.
References d.
Referenced by KDChart::CartesianAxis::maximumSize().
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 }
QSize KDChart::AbstractCoordinatePlane::maximumSize | ( | ) | const [virtual] |
pure virtual in QLayoutItem
Definition at line 217 of file KDChartAbstractCoordinatePlane.cpp.
Referenced by sizeHint().
00218 { 00219 // No maximum size set. Especially not parent()->size(), we are not layouting 00220 // to the parent widget's size when using Chart::paint()! 00221 return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX); 00222 }
QSize KDChart::AbstractCoordinatePlane::minimumSize | ( | ) | const [virtual] |
QSize KDChart::AbstractCoordinatePlane::minimumSizeHint | ( | ) | const [virtual] |
[reimplemented]
Reimplemented in KDChart::TernaryCoordinatePlane.
Definition at line 144 of file KDChartAbstractCoordinatePlane.cpp.
void KDChart::AbstractCoordinatePlane::mouseDoubleClickEvent | ( | QMouseEvent * | event | ) |
Definition at line 325 of file KDChartAbstractCoordinatePlane.cpp.
References d, and mousePressEvent().
Referenced by KDChart::Chart::mouseDoubleClickEvent().
00326 { 00327 if( event->button() == Qt::RightButton ) 00328 { 00329 // othewise the second click gets lost 00330 // which is pretty annoying when zooming out fast 00331 mousePressEvent( event ); 00332 } 00333 KDAB_FOREACH( AbstractDiagram * a, d->diagrams ) 00334 { 00335 a->mouseDoubleClickEvent( event ); 00336 } 00337 }
void KDChart::AbstractCoordinatePlane::mouseMoveEvent | ( | QMouseEvent * | event | ) |
Definition at line 387 of file KDChartAbstractCoordinatePlane.cpp.
References d, and geometry().
Referenced by KDChart::Chart::mouseMoveEvent().
00388 { 00389 if( d->rubberBand != 0 ) 00390 { 00391 const QRect normalized = QRect( d->rubberBandOrigin, event->pos() ).normalized(); 00392 d->rubberBand->setGeometry( normalized & geometry() ); 00393 00394 event->accept(); 00395 } 00396 00397 KDAB_FOREACH( AbstractDiagram * a, d->diagrams ) 00398 { 00399 a->mouseMoveEvent( event ); 00400 } 00401 }
void KDChart::AbstractCoordinatePlane::mousePressEvent | ( | QMouseEvent * | event | ) |
Definition at line 285 of file KDChartAbstractCoordinatePlane.cpp.
References d, parent(), setZoomCenter(), setZoomFactorX(), and setZoomFactorY().
Referenced by mouseDoubleClickEvent(), and KDChart::Chart::mousePressEvent().
00286 { 00287 if( event->button() == Qt::LeftButton ) 00288 { 00289 if( d->enableRubberBandZooming && d->rubberBand == 0 ) 00290 d->rubberBand = new QRubberBand( QRubberBand::Rectangle, qobject_cast< QWidget* >( parent() ) ); 00291 00292 if( d->rubberBand != 0 ) 00293 { 00294 d->rubberBandOrigin = event->pos(); 00295 d->rubberBand->setGeometry( QRect( event->pos(), QSize() ) ); 00296 d->rubberBand->show(); 00297 00298 event->accept(); 00299 } 00300 } 00301 else if( event->button() == Qt::RightButton ) 00302 { 00303 if( d->enableRubberBandZooming && !d->rubberBandZoomConfigHistory.isEmpty() ) 00304 { 00305 // restore the last config from the stack 00306 ZoomParameters config = d->rubberBandZoomConfigHistory.pop(); 00307 setZoomFactorX( config.xFactor ); 00308 setZoomFactorY( config.yFactor ); 00309 setZoomCenter( config.center() ); 00310 00311 QWidget* const p = qobject_cast< QWidget* >( parent() ); 00312 if( p != 0 ) 00313 p->update(); 00314 00315 event->accept(); 00316 } 00317 } 00318 00319 KDAB_FOREACH( AbstractDiagram * a, d->diagrams ) 00320 { 00321 a->mousePressEvent( event ); 00322 } 00323 }
void KDChart::AbstractCoordinatePlane::mouseReleaseEvent | ( | QMouseEvent * | event | ) |
Definition at line 339 of file KDChartAbstractCoordinatePlane.cpp.
References d, geometry(), setZoomCenter(), setZoomFactorX(), setZoomFactorY(), zoomCenter(), zoomFactorX(), and zoomFactorY().
Referenced by KDChart::Chart::mouseReleaseEvent().
00340 { 00341 if( d->rubberBand != 0 ) 00342 { 00343 // save the old config on the stack 00344 d->rubberBandZoomConfigHistory.push( ZoomParameters( zoomFactorX(), zoomFactorY(), zoomCenter() ) ); 00345 00346 // this is the height/width of the rubber band in pixel space 00347 const double rubberWidth = static_cast< double >( d->rubberBand->width() ); 00348 const double rubberHeight = static_cast< double >( d->rubberBand->height() ); 00349 00350 // this is the center of the rubber band in pixel space 00351 const double rubberCenterX = static_cast< double >( d->rubberBand->geometry().center().x() - geometry().x() ); 00352 const double rubberCenterY = static_cast< double >( d->rubberBand->geometry().center().y() - geometry().y() ); 00353 00354 // this is the height/width of the plane in pixel space 00355 const double myWidth = static_cast< double >( geometry().width() ); 00356 const double myHeight = static_cast< double >( geometry().height() ); 00357 00358 // this describes the new center of zooming, relative to the plane pixel space 00359 const double newCenterX = rubberCenterX / myWidth / zoomFactorX() + zoomCenter().x() - 0.5 / zoomFactorX(); 00360 const double newCenterY = rubberCenterY / myHeight / zoomFactorY() + zoomCenter().y() - 0.5 / zoomFactorY(); 00361 00362 // this will be the new zoom factor 00363 const double newZoomFactorX = zoomFactorX() * myWidth / rubberWidth; 00364 const double newZoomFactorY = zoomFactorY() * myHeight / rubberHeight; 00365 00366 // and this the new center 00367 const QPointF newZoomCenter( newCenterX, newCenterY ); 00368 00369 setZoomFactorX( newZoomFactorX ); 00370 setZoomFactorY( newZoomFactorY ); 00371 setZoomCenter( newZoomCenter ); 00372 00373 00374 d->rubberBand->parentWidget()->update(); 00375 delete d->rubberBand; 00376 d->rubberBand = 0; 00377 00378 event->accept(); 00379 } 00380 00381 KDAB_FOREACH( AbstractDiagram * a, d->diagrams ) 00382 { 00383 a->mouseReleaseEvent( event ); 00384 } 00385 }
void KDChart::AbstractCoordinatePlane::needLayoutPlanes | ( | ) | [signal] |
Emitted when plane needs to trigger the Chart's layouting of the coord.
planes.
Referenced by layoutPlanes().
void KDChart::AbstractCoordinatePlane::needRelayout | ( | ) | [signal] |
void KDChart::AbstractCoordinatePlane::needUpdate | ( | ) | [signal] |
virtual void KDChart::AbstractLayoutItem::paint | ( | QPainter * | ) | [pure virtual, inherited] |
Implemented in KDChart::CartesianAxis, KDChart::CartesianCoordinatePlane, KDChart::TextLayoutItem, 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 196 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes().
Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().
00197 { 00198 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()", 00199 "Private class was not initialized!" ); 00200 paintBackgroundAttributes( painter, rect, d->backgroundAttributes ); 00201 }
void AbstractAreaBase::paintBackgroundAttributes | ( | QPainter & | painter, | |
const QRect & | rectangle, | |||
const KDChart::BackgroundAttributes & | attributes | |||
) | [static, inherited] |
Definition at line 127 of file KDChartAbstractAreaBase.cpp.
References KDChart::BackgroundAttributes::BackgroundPixmapModeCentered, KDChart::BackgroundAttributes::BackgroundPixmapModeNone, KDChart::BackgroundAttributes::BackgroundPixmapModeScaled, KDChart::BackgroundAttributes::BackgroundPixmapModeStretched, KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode().
Referenced by KDChart::AbstractAreaBase::paintBackground().
00129 { 00130 if( !attributes.isVisible() ) return; 00131 00132 /* first draw the brush (may contain a pixmap)*/ 00133 if( Qt::NoBrush != attributes.brush().style() ) { 00134 KDChart::PainterSaver painterSaver( &painter ); 00135 painter.setPen( Qt::NoPen ); 00136 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) ); 00137 painter.setBrushOrigin( newTopLeft ); 00138 painter.setBrush( attributes.brush() ); 00139 painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) ); 00140 } 00141 /* next draw the backPixmap over the brush */ 00142 if( !attributes.pixmap().isNull() && 00143 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) { 00144 QPointF ol = rect.topLeft(); 00145 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() ) 00146 { 00147 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 ); 00148 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 ); 00149 painter.drawPixmap( ol, attributes.pixmap() ); 00150 } else { 00151 QMatrix m; 00152 double zW = (double)rect.width() / (double)attributes.pixmap().width(); 00153 double zH = (double)rect.height() / (double)attributes.pixmap().height(); 00154 switch( attributes.pixmapMode() ) { 00155 case BackgroundAttributes::BackgroundPixmapModeScaled: 00156 { 00157 double z; 00158 z = qMin( zW, zH ); 00159 m.scale( z, z ); 00160 } 00161 break; 00162 case BackgroundAttributes::BackgroundPixmapModeStretched: 00163 m.scale( zW, zH ); 00164 break; 00165 default: 00166 ; // Cannot happen, previously checked 00167 } 00168 QPixmap pm = attributes.pixmap().transformed( m ); 00169 ol.setX( rect.center().x() - pm.width() / 2 ); 00170 ol.setY( rect.center().y() - pm.height()/ 2 ); 00171 painter.drawPixmap( ol, pm ); 00172 } 00173 } 00174 }
void KDChart::AbstractLayoutItem::paintCtx | ( | PaintContext * | context | ) | [virtual, inherited] |
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis, and KDChart::TernaryAxis.
Definition at line 77 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
00078 { 00079 if( context ) 00080 paint( context->painter() ); 00081 }
void AbstractAreaBase::paintFrame | ( | QPainter & | painter, | |
const QRect & | rectangle | |||
) | [virtual, inherited] |
Definition at line 204 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::paintFrameAttributes().
Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().
00205 { 00206 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()", 00207 "Private class was not initialized!" ); 00208 paintFrameAttributes( painter, rect, d->frameAttributes ); 00209 }
void AbstractAreaBase::paintFrameAttributes | ( | QPainter & | painter, | |
const QRect & | rectangle, | |||
const KDChart::FrameAttributes & | attributes | |||
) | [static, inherited] |
Definition at line 177 of file KDChartAbstractAreaBase.cpp.
References KDChart::FrameAttributes::isVisible(), and KDChart::FrameAttributes::pen().
Referenced by KDChart::AbstractAreaBase::paintFrame().
00179 { 00180 00181 if( !attributes.isVisible() ) return; 00182 00183 // Note: We set the brush to NoBrush explicitely here. 00184 // Otherwise we might get a filled rectangle, so any 00185 // previously drawn background would be overwritten by that area. 00186 00187 const QPen oldPen( painter.pen() ); 00188 const QBrush oldBrush( painter.brush() ); 00189 painter.setPen( attributes.pen() ); 00190 painter.setBrush( Qt::NoBrush ); 00191 painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) ); 00192 painter.setBrush( oldBrush ); 00193 painter.setPen( oldPen ); 00194 }
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 }
const KDChart::Chart * KDChart::AbstractCoordinatePlane::parent | ( | ) | const |
Definition at line 194 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00195 { 00196 return d->parent; 00197 }
KDChart::Chart * KDChart::AbstractCoordinatePlane::parent | ( | ) |
Definition at line 199 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by AbstractCoordinatePlane(), KDChart::CartesianAxis::maximumSize(), mousePressEvent(), and setParent().
00200 { 00201 return d->parent; 00202 }
QLayout* KDChart::AbstractLayoutItem::parentLayout | ( | ) | [inherited] |
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::AbstractCoordinatePlane::propertiesChanged | ( | ) | [signal] |
Emitted upon change of a property of the Coordinate Plane or any of its components.
Referenced by KDChart::CartesianCoordinatePlane::addDiagram(), KDChart::CartesianCoordinatePlane::adjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::adjustRangesToData(), KDChart::CartesianCoordinatePlane::adjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustGridToZoom(), KDChart::CartesianCoordinatePlane::setAutoAdjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setAxesCalcModes(), KDChart::CartesianCoordinatePlane::setAxesCalcModeX(), KDChart::CartesianCoordinatePlane::setAxesCalcModeY(), KDChart::PolarCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setHorizontalRange(), KDChart::CartesianCoordinatePlane::setHorizontalRangeReversed(), KDChart::CartesianCoordinatePlane::setIsometricScaling(), KDChart::CartesianCoordinatePlane::setVerticalRange(), KDChart::CartesianCoordinatePlane::setVerticalRangeReversed(), KDChart::CartesianCoordinatePlane::setZoomCenter(), KDChart::CartesianCoordinatePlane::setZoomFactorX(), and KDChart::CartesianCoordinatePlane::setZoomFactorY().
AbstractCoordinatePlane * KDChart::AbstractCoordinatePlane::referenceCoordinatePlane | ( | ) | const |
There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The first is the reference plane.
If such a reference plane is set, on a plane, it will use the same cell in the layout as that one. In addition to this, planes can share an axis. In that case they will be layed out in relation to each other as suggested by the position of the axis. If, for example Plane1 and Plane2 share an axis at position Left, that will result in the layout: Axis Plane1 Plane 2, vertically. If Plane1 also happens to be Plane2's reference plane, both planes are drawn over each other. The reference plane concept allows two planes to share the same space even if neither has any axis, and in case there are shared axis, it is used to decided, whether the planes should be painted on top of each other or layed out vertically or horizontally next to each other.
Definition at line 184 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00185 { 00186 return d->referenceCoordinatePlane; 00187 }
void KDChart::AbstractCoordinatePlane::relayout | ( | ) | [slot] |
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
Definition at line 257 of file KDChartAbstractCoordinatePlane.cpp.
References needRelayout().
00258 { 00259 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called"); 00260 emit needRelayout(); 00261 }
void KDChart::AbstractLayoutItem::removeFromParentLayout | ( | ) | [inherited] |
Definition at line 80 of file KDChartLayoutItems.h.
Referenced by KDChart::Chart::takeCoordinatePlane().
00081 { 00082 if( mParentLayout ){ 00083 if( widget() ) 00084 mParentLayout->removeWidget( widget() ); 00085 else 00086 mParentLayout->removeItem( this ); 00087 } 00088 }
void AbstractCoordinatePlane::replaceDiagram | ( | AbstractDiagram * | diagram, | |
AbstractDiagram * | oldDiagram = 0 | |||
) | [virtual] |
Replaces the old diagram, or appends the diagram, it there is none yet.
diagram | The diagram to be used instead of the old diagram. This parameter must not be zero, or the method will do nothing. | |
oldDiagram | The diagram to be removed by the new diagram. This diagram will be deleted automatically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no diagram yet, the new diagram will just be added. |
Definition at line 86 of file KDChartAbstractCoordinatePlane.cpp.
References addDiagram(), d, diagram(), layoutDiagrams(), layoutPlanes(), takeDiagram(), and update().
Referenced by KDChart::Widget::setType().
00087 { 00088 if( diagram && oldDiagram_ != diagram ){ 00089 AbstractDiagram* oldDiagram = oldDiagram_; 00090 if( d->diagrams.count() ){ 00091 if( ! oldDiagram ) 00092 oldDiagram = d->diagrams.first(); 00093 takeDiagram( oldDiagram ); 00094 } 00095 delete oldDiagram; 00096 addDiagram( diagram ); 00097 layoutDiagrams(); 00098 layoutPlanes(); // there might be new axes, etc 00099 update(); 00100 } 00101 }
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.
Definition at line 85 of file KDChartAbstractArea.cpp.
References d.
Referenced by KDChart::CartesianAxis::maximumSize().
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 }
void AbstractAreaBase::setBackgroundAttributes | ( | const BackgroundAttributes & | a | ) | [inherited] |
Definition at line 111 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::positionHasChanged().
00112 { 00113 if( d->backgroundAttributes == a ) 00114 return; 00115 00116 d->backgroundAttributes = a; 00117 positionHasChanged(); 00118 }
void AbstractAreaBase::setFrameAttributes | ( | const FrameAttributes & | a | ) | [inherited] |
Definition at line 97 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::positionHasChanged().
Referenced by KDChart::Legend::clone().
00098 { 00099 if( d->frameAttributes == a ) 00100 return; 00101 00102 d->frameAttributes = a; 00103 positionHasChanged(); 00104 }
void KDChart::AbstractCoordinatePlane::setGeometry | ( | const QRect & | r | ) | [virtual] |
pure virtual in QLayoutItem
Reimplemented in KDChart::CartesianCoordinatePlane.
Definition at line 236 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::CartesianCoordinatePlane::setGeometry().
00237 { 00238 // qDebug() << "KDChart::AbstractCoordinatePlane::setGeometry(" << r << ") called"; 00239 if( d->geometry != r ){ 00240 d->geometry = r; 00241 // Note: We do *not* call update() here 00242 // because it would invoke KDChart::update() recursively. 00243 } 00244 }
void KDChart::AbstractCoordinatePlane::setGlobalGridAttributes | ( | const GridAttributes & | ) |
Set the grid attributes to be used by this coordinate plane.
To disable grid painting, for example, your code should like this:
GridAttributes ga = plane->globalGridAttributes();
ga.setGlobalGridVisible( false );
plane->setGlobalGridAttributes( ga );
Definition at line 155 of file KDChartAbstractCoordinatePlane.cpp.
void KDChart::AbstractCoordinatePlane::setGridNeedsRecalculate | ( | ) | [slot] |
Used by the chart to clear the cached grid data.
Definition at line 174 of file KDChartAbstractCoordinatePlane.cpp.
References d.
Referenced by KDChart::Chart::resizeEvent().
00175 { 00176 d->grid->setNeedRecalculate(); 00177 }
void KDChart::AbstractCoordinatePlane::setParent | ( | Chart * | parent | ) |
Called internally by KDChart::Chart.
Definition at line 189 of file KDChartAbstractCoordinatePlane.cpp.
Referenced by KDChart::Chart::addCoordinatePlane(), and KDChart::Chart::takeCoordinatePlane().
void KDChart::AbstractLayoutItem::setParentLayout | ( | QLayout * | lay | ) | [inherited] |
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 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::HeaderFooter::setParent(), and KDChart::AbstractCartesianDiagram::takeAxis().
00065 { 00066 mParent = widget; 00067 }
void KDChart::AbstractCoordinatePlane::setReferenceCoordinatePlane | ( | AbstractCoordinatePlane * | plane | ) |
Set another coordinate plane to be used as the reference plane for this one.
plane | The coordinate plane to be used the reference plane for this one. |
Definition at line 179 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00180 { 00181 d->referenceCoordinatePlane = plane; 00182 }
void KDChart::AbstractCoordinatePlane::setRubberBandZoomingEnabled | ( | bool | enable | ) |
Enables or disables zooming with a rubber band using the mouse.
Definition at line 269 of file KDChartAbstractCoordinatePlane.cpp.
References d.
00270 { 00271 d->enableRubberBandZooming = enable; 00272 00273 if( !enable && d->rubberBand != 0 ) 00274 { 00275 delete d->rubberBand; 00276 d->rubberBand = 0; 00277 } 00278 }
virtual void KDChart::AbstractCoordinatePlane::setZoomCenter | ( | const QPointF & | center | ) | [virtual] |
Set the point (in value coordinates) to be used as the center point in zoom operations.
center | The point to use. |
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 182 of file KDChartAbstractCoordinatePlane.h.
Referenced by mousePressEvent(), and mouseReleaseEvent().
virtual void KDChart::AbstractCoordinatePlane::setZoomFactorX | ( | double | factor | ) | [virtual] |
Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.
factor | The new zoom factor |
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 162 of file KDChartAbstractCoordinatePlane.h.
Referenced by mousePressEvent(), and mouseReleaseEvent().
virtual void KDChart::AbstractCoordinatePlane::setZoomFactorY | ( | double | factor | ) | [virtual] |
Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.
factor | The new zoom factor |
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 169 of file KDChartAbstractCoordinatePlane.h.
Referenced by mousePressEvent(), and mouseReleaseEvent().
AbstractCoordinatePlane * KDChart::AbstractCoordinatePlane::sharedAxisMasterPlane | ( | QPainter * | p = 0 |
) | [virtual] |
Reimplemented in KDChart::CartesianCoordinatePlane.
Definition at line 408 of file KDChartAbstractCoordinatePlane.cpp.
Referenced by KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
QSize KDChart::AbstractCoordinatePlane::sizeHint | ( | ) | const [virtual] |
pure virtual in QLayoutItem
Definition at line 229 of file KDChartAbstractCoordinatePlane.cpp.
References maximumSize().
00230 { 00231 // we return our maxiumu (which is the full size of the Chart) 00232 // even if we know the plane will be smaller 00233 return maximumSize(); 00234 }
void KDChart::AbstractLayoutItem::sizeHintChanged | ( | ) | const [virtual, inherited] |
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 86 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::TextLayoutItem::sizeHint().
00087 { 00088 // This is exactly like what QWidget::updateGeometry does. 00089 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called"); 00090 if( mParent ) { 00091 if ( mParent->layout() ) 00092 mParent->layout()->invalidate(); 00093 else 00094 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) ); 00095 } 00096 }
QSizePolicy KDChart::AbstractCoordinatePlane::sizePolicy | ( | ) | const [virtual] |
[reimplemented]
Reimplemented in KDChart::TernaryCoordinatePlane.
Definition at line 150 of file KDChartAbstractCoordinatePlane.cpp.
00151 { 00152 return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); 00153 }
void AbstractCoordinatePlane::takeDiagram | ( | AbstractDiagram * | diagram | ) | [virtual] |
Removes the diagram from the plane, without deleting it.
The plane no longer owns the diagram, so it is the caller's responsibility to delete the diagram.
Definition at line 104 of file KDChartAbstractCoordinatePlane.cpp.
References d, diagram(), layoutDiagrams(), KDChart::AbstractDiagram::setCoordinatePlane(), and update().
Referenced by replaceDiagram().
00105 { 00106 const int idx = d->diagrams.indexOf( diagram ); 00107 if( idx != -1 ){ 00108 d->diagrams.removeAt( idx ); 00109 diagram->setParent( 0 ); 00110 diagram->setCoordinatePlane( 0 ); 00111 layoutDiagrams(); 00112 update(); 00113 } 00114 }
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.
Definition at line 93 of file KDChartAbstractArea.cpp.
References d.
Referenced by KDChart::CartesianAxis::maximumSize().
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 }
virtual const QPointF KDChart::AbstractCoordinatePlane::translate | ( | const QPointF & | diagramPoint | ) | const [pure virtual] |
Translate the given point in value space coordinates to a position in pixel space.
diagramPoint | The point in value coordinates. |
Implemented in KDChart::CartesianCoordinatePlane, KDChart::PolarCoordinatePlane, and KDChart::TernaryCoordinatePlane.
Referenced by KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), and KDChart::AbstractDiagram::paintMarkers().
void KDChart::AbstractCoordinatePlane::update | ( | ) | [slot] |
Calling update() on the plane triggers the global KDChart::Chart::update().
Definition at line 251 of file KDChartAbstractCoordinatePlane.cpp.
References needUpdate().
Referenced by addDiagram(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), replaceDiagram(), KDChart::PolarCoordinatePlane::resetGridAttributes(), KDChart::CartesianCoordinatePlane::resetGridAttributes(), setGlobalGridAttributes(), KDChart::PolarCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setGridAttributes(), and takeDiagram().
00252 { 00253 //qDebug("KDChart::AbstractCoordinatePlane::update() called"); 00254 emit needUpdate(); 00255 }
virtual QPointF KDChart::AbstractCoordinatePlane::zoomCenter | ( | ) | const [virtual] |
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 175 of file KDChartAbstractCoordinatePlane.h.
Referenced by mouseReleaseEvent().
virtual double KDChart::AbstractCoordinatePlane::zoomFactorX | ( | ) | const [virtual] |
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 149 of file KDChartAbstractCoordinatePlane.h.
Referenced by mouseReleaseEvent().
virtual double KDChart::AbstractCoordinatePlane::zoomFactorY | ( | ) | const [virtual] |
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 155 of file KDChartAbstractCoordinatePlane.h.
Referenced by mouseReleaseEvent().
QWidget* KDChart::AbstractLayoutItem::mParent [protected, inherited] |
Definition at line 90 of file KDChartLayoutItems.h.
Referenced by KDChart::AbstractLayoutItem::setParentWidget(), KDChart::TextLayoutItem::setText(), KDChart::TextLayoutItem::setTextAttributes(), and KDChart::AbstractLayoutItem::sizeHintChanged().
QLayout* KDChart::AbstractLayoutItem::mParentLayout [protected, inherited] |
Definition at line 91 of file KDChartLayoutItems.h.
Referenced by KDChart::AutoSpacerLayoutItem::paint().