#include <KDChartLeveyJenningsAxis.h>
For being useful, axes need to be assigned to a diagram, see LeveyJenningsDiagram::addAxis and LeveyJenningsDiagram::takeAxis.
Definition at line 50 of file KDChartLeveyJenningsAxis.h.
Public Types | |
enum | Position { Bottom, Top, Right, Left } |
Public Slots | |
void | setCachedSizeDirty () const |
int | tickLength (bool subUnitTicks=false) const |
void | update () |
Signals | |
void | positionChanged (AbstractArea *) |
Public Member Functions | |
void | alignToReferencePoint (const RelativePosition &position) |
QMap< double, QString > | annotations () const |
Returns the currently set axis annotations. | |
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. | |
bool | compare (const CartesianAxis *other) const |
Returns true if both axes have the same settings. | |
bool | compare (const LeveyJenningsAxis *other) const |
Returns true if both axes have the same settings. | |
virtual void | connectSignals () |
Wireing the signal/slot connections. | |
const AbstractCoordinatePlane * | coordinatePlane () 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. | |
Qt::DateFormat | dateFormat () const |
void | deleteObserver (AbstractDiagram *diagram) |
const AbstractDiagram * | diagram () const |
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 |
bool | hasDefaultTitleTextAttributes () const |
virtual bool | isAbscissa () const |
virtual bool | isEmpty () const |
pure virtual in QLayoutItem | |
virtual bool | isOrdinate () const |
QStringList | labels () const |
Returns a list of strings, that are used as axis labels, as set via setLabels. | |
virtual void | layoutPlanes () |
virtual int | leftOverlap (bool doNotRecalculate=false) const |
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint(). | |
LeveyJenningsAxis (LeveyJenningsDiagram *diagram=0) | |
C'tor of the class for levey jennings axes. | |
virtual QSize | maximumSize () const |
pure virtual in QLayoutItem | |
virtual QSize | minimumSize () const |
pure virtual in QLayoutItem | |
bool | observedBy (AbstractDiagram *diagram) const |
virtual void | paint (QPainter *) |
reimpl | |
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) |
void | paintCtx (PaintContext *) |
reimpl | |
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 () |
virtual const Position | position () const |
void | removeFromParentLayout () |
void | resetTitleTextAttributes () |
Reset the title text attributes to the built-in default:. | |
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 | setAnnotations (const QMap< double, QString > &annotations) |
Sets the axis annotations to annotations. | |
void | setBackgroundAttributes (const BackgroundAttributes &a) |
void | setDateFormat (Qt::DateFormat format) |
void | setFrameAttributes (const FrameAttributes &a) |
virtual void | setGeometry (const QRect &r) |
pure virtual in QLayoutItem | |
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. | |
virtual void | setPosition (Position p) |
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. | |
void | setTitleText (const QString &text) |
void | setTitleTextAttributes (const TextAttributes &a) |
void | setType (LeveyJenningsGridAttributes::GridType type) |
Sets the type of the axis to type. | |
QStringList | shortLabels () const |
Returns a list of strings, that are used as axis labels, as set via setShortLabels. | |
virtual QSize | sizeHint () const |
pure virtual in QLayoutItem | |
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. | |
QString | titleText () const |
TextAttributes | titleTextAttributes () const |
Returns the text attributes that will be used for displaying the title text. | |
virtual int | topOverlap (bool doNotRecalculate=false) const |
This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint(). | |
LeveyJenningsGridAttributes::GridType | type () const |
| |
~LeveyJenningsAxis () | |
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 | paintAsAbscissa (PaintContext *) |
virtual void | paintAsOrdinate (PaintContext *) |
virtual void | positionHasChanged () |
Protected Attributes | |
QWidget * | mParent |
QLayout * | mParentLayout |
enum KDChart::CartesianAxis::Position [inherited] |
LeveyJenningsAxis::LeveyJenningsAxis | ( | LeveyJenningsDiagram * | diagram = 0 |
) | [explicit] |
C'tor of the class for levey jennings axes.
Definition at line 48 of file KDChartLeveyJenningsAxis.cpp.
References StockDiagram::init().
00049 : CartesianAxis ( new Private( diagram, this ), diagram ) 00050 { 00051 init(); 00052 }
LeveyJenningsAxis::~LeveyJenningsAxis | ( | ) |
Definition at line 54 of file KDChartLeveyJenningsAxis.cpp.
References d, KDChart::AbstractAxis::diagram(), and KDChart::AbstractCartesianDiagram::takeAxis().
00055 { 00056 // when we remove the first axis it will unregister itself and 00057 // propagate the next one to the primary, thus the while loop 00058 while ( d->mDiagram ) { 00059 LeveyJenningsDiagram *cd = qobject_cast< LeveyJenningsDiagram* >( d->mDiagram ); 00060 cd->takeAxis( this ); 00061 } 00062 Q_FOREACH( AbstractDiagram *diagram, d->secondaryDiagrams ) { 00063 LeveyJenningsDiagram *cd = qobject_cast< LeveyJenningsDiagram* >( diagram ); 00064 cd->takeAxis( this ); 00065 } 00066 }
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 }
QMap< double, QString > CartesianAxis::annotations | ( | ) | const [inherited] |
Returns the currently set axis annotations.
Definition at line 1769 of file KDChartCartesianAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::paintCtx().
01770 { 01771 return d->annotations; 01772 }
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 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.
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 [inherited] |
Returns true if both axes have the same settings.
Definition at line 142 of file KDChartAbstractAxis.cpp.
References KDChart::AbstractAxis::labels(), KDChart::AbstractAxis::shortLabels(), and KDChart::AbstractAxis::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 }
bool CartesianAxis::compare | ( | const CartesianAxis * | other | ) | const [inherited] |
Returns true if both axes have the same settings.
Definition at line 83 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::position(), KDChart::CartesianAxis::titleText(), and KDChart::CartesianAxis::titleTextAttributes().
00084 { 00085 if( other == this ) return true; 00086 if( ! other ){ 00087 //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer"; 00088 return false; 00089 } 00090 /* 00091 qDebug() << (position() == other->position()); 00092 qDebug() << (titleText() == other->titleText()); 00093 qDebug() << (titleTextAttributes() == other->titleTextAttributes()); 00094 */ 00095 return ( static_cast<const AbstractAxis*>(this)->compare( other ) ) && 00096 ( position() == other->position() ) && 00097 ( titleText() == other->titleText() ) && 00098 ( titleTextAttributes() == other->titleTextAttributes() ); 00099 }
bool LeveyJenningsAxis::compare | ( | const LeveyJenningsAxis * | other | ) | const |
Returns true if both axes have the same settings.
Definition at line 124 of file KDChartLeveyJenningsAxis.cpp.
References type().
00125 { 00126 if( other == this ) return true; 00127 if( ! other ){ 00128 //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer"; 00129 return false; 00130 } 00131 return ( static_cast<const CartesianAxis*>(this)->compare( other ) ) && 00132 ( type() == other->type() ); 00133 }
void AbstractAxis::connectSignals | ( | ) | [virtual, inherited] |
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.
Definition at line 211 of file KDChartAbstractAxis.cpp.
References d, and KDChart::AbstractAxis::update().
Referenced by KDChart::AbstractAxis::createObserver().
00212 { 00213 if( d->observer ){ 00214 connect( d->observer, SIGNAL( diagramDataChanged( AbstractDiagram *) ), 00215 this, SLOT( update() ) ); 00216 } 00217 }
const AbstractCoordinatePlane * AbstractAxis::coordinatePlane | ( | ) | const [inherited] |
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 | ) | [inherited] |
Definition at line 177 of file KDChartAbstractAxis.cpp.
References KDChart::AbstractAxis::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, inherited] |
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.
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.) |
label
. Definition at line 161 of file KDChartAbstractAxis.cpp.
Referenced by paintAsOrdinate(), and KDChart::CartesianAxis::paintCtx().
Qt::DateFormat LeveyJenningsAxis::dateFormat | ( | ) | const |
Definition at line 114 of file KDChartLeveyJenningsAxis.cpp.
References d.
Referenced by paintAsAbscissa().
00115 { 00116 return d->format; 00117 }
void AbstractAxis::delayedInit | ( | ) | [protected, virtual, slot, inherited] |
called for initializing after the c'tor has completed
Definition at line 134 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::AbstractAxis::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 | ) | [inherited] |
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 [inherited] |
Definition at line 356 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::paintCtx(), KDChart::CartesianAxis::~CartesianAxis(), and ~LeveyJenningsAxis().
00357 { 00358 return d->diagram(); 00359 }
Qt::Orientations CartesianAxis::expandingDirections | ( | ) | const [virtual, inherited] |
pure virtual in QLayoutItem
Definition at line 1400 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::Bottom, KDChart::CartesianAxis::Left, KDChart::CartesianAxis::position(), KDChart::CartesianAxis::Right, and KDChart::CartesianAxis::Top.
01401 { 01402 Qt::Orientations ret; 01403 switch ( position() ) 01404 { 01405 case Bottom: 01406 case Top: 01407 ret = Qt::Horizontal; 01408 break; 01409 case Left: 01410 case Right: 01411 ret = Qt::Vertical; 01412 break; 01413 default: 01414 Q_ASSERT( false ); // all positions need to be handeld 01415 break; 01416 }; 01417 return ret; 01418 }
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 }
QRect CartesianAxis::geometry | ( | ) | const [virtual, inherited] |
pure virtual in QLayoutItem
Implements KDChart::AbstractAxis.
Definition at line 1748 of file KDChartCartesianAxis.cpp.
References d.
Referenced by paintAsAbscissa(), paintAsOrdinate(), and KDChart::CartesianAxis::paintCtx().
01749 { 01750 return d->geometry; 01751 }
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 }
bool CartesianAxis::hasDefaultTitleTextAttributes | ( | ) | const [inherited] |
Definition at line 138 of file KDChartCartesianAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::titleTextAttributes().
00139 { 00140 return d->useDefaultTextAttributes; 00141 }
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 }
bool CartesianAxis::isAbscissa | ( | ) | const [virtual, inherited] |
Definition at line 216 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::Bottom, d, KDChart::CartesianAxis::Left, KDChart::CartesianAxis::position(), referenceDiagramIsBarDiagram(), KDChart::CartesianAxis::Right, and KDChart::CartesianAxis::Top.
Referenced by paintAsAbscissa(), KDChart::CartesianAxis::paintCtx(), KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane(), and KDChart::CartesianAxis::tickLength().
00217 { 00218 const Qt::Orientation diagramOrientation = referenceDiagramIsBarDiagram( d->diagram() ) ? ((BarDiagram*)(d->diagram()))->orientation() 00219 : Qt::Vertical; 00220 return diagramOrientation == Qt::Vertical ? position() == Bottom || position() == Top 00221 : position() == Left || position() == Right; 00222 }
bool CartesianAxis::isEmpty | ( | ) | const [virtual, inherited] |
pure virtual in QLayoutItem
Definition at line 1395 of file KDChartCartesianAxis.cpp.
Referenced by KDChart::CartesianAxis::paintCtx().
bool CartesianAxis::isOrdinate | ( | ) | const [virtual, inherited] |
Definition at line 224 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::Bottom, d, KDChart::CartesianAxis::Left, KDChart::CartesianAxis::position(), referenceDiagramIsBarDiagram(), KDChart::CartesianAxis::Right, and KDChart::CartesianAxis::Top.
Referenced by paintAsOrdinate(), paintCtx(), KDChart::CartesianAxis::paintCtx(), and KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane().
00225 { 00226 const Qt::Orientation diagramOrientation = referenceDiagramIsBarDiagram( d->diagram() ) ? ((BarDiagram*)(d->diagram()))->orientation() 00227 : Qt::Vertical; 00228 return diagramOrientation == Qt::Vertical ? position() == Left || position() == Right 00229 : position() == Bottom || position() == Top; 00230 }
QStringList AbstractAxis::labels | ( | ) | const [inherited] |
Returns a list of strings, that are used as axis labels, as set via setLabels.
Definition at line 306 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::AbstractAxis::compare(), paintAsOrdinate(), KDChart::TernaryAxis::paintCtx(), and KDChart::CartesianAxis::paintCtx().
00307 { 00308 return d->hardLabels; 00309 }
void CartesianAxis::layoutPlanes | ( | ) | [virtual, inherited] |
Definition at line 158 of file KDChartCartesianAxis.cpp.
References d, and KDChart::AbstractCoordinatePlane::layoutPlanes().
Referenced by KDChart::CartesianAxis::resetTitleTextAttributes(), KDChart::CartesianAxis::setPosition(), KDChart::CartesianAxis::setTitleText(), and KDChart::CartesianAxis::setTitleTextAttributes().
00159 { 00160 //qDebug() << "CartesianAxis::layoutPlanes()"; 00161 if( ! d->diagram() || ! d->diagram()->coordinatePlane() ) { 00162 //qDebug() << "CartesianAxis::layoutPlanes(): Sorry, found no plane."; 00163 return; 00164 } 00165 AbstractCoordinatePlane* plane = d->diagram()->coordinatePlane(); 00166 if( plane ){ 00167 plane->layoutPlanes(); 00168 //qDebug() << "CartesianAxis::layoutPlanes() OK"; 00169 } 00170 }
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::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 }
QSize CartesianAxis::maximumSize | ( | ) | const [virtual, inherited] |
pure virtual in QLayoutItem
Definition at line 1452 of file KDChartCartesianAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::minimumSize(), and KDChart::CartesianAxis::sizeHint().
01453 { 01454 if( ! d->cachedMaximumSize.isValid() ) 01455 d->cachedMaximumSize = d->calculateMaximumSize(); 01456 return d->cachedMaximumSize; 01457 }
QSize CartesianAxis::minimumSize | ( | ) | const [virtual, inherited] |
pure virtual in QLayoutItem
Definition at line 1730 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::maximumSize().
01731 { 01732 return maximumSize(); 01733 }
bool KDChart::AbstractAxis::observedBy | ( | AbstractDiagram * | diagram | ) | const [inherited] |
Definition at line 361 of file KDChartAbstractAxis.cpp.
References d.
00362 { 00363 return d->hasDiagram( diagram ); 00364 }
void CartesianAxis::paint | ( | QPainter * | painter | ) | [virtual, inherited] |
reimpl
Implements KDChart::AbstractLayoutItem.
Definition at line 232 of file KDChartCartesianAxis.cpp.
References KDChart::AbstractArea::areaGeometry(), d, KDChart::CartesianAxis::paintCtx(), KDChart::PaintContext::setCoordinatePlane(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().
00233 { 00234 if( ! d->diagram() || ! d->diagram()->coordinatePlane() ) return; 00235 PaintContext ctx; 00236 ctx.setPainter ( painter ); 00237 ctx.setCoordinatePlane( d->diagram()->coordinatePlane() ); 00238 const QRect rect( areaGeometry() ); 00239 00240 //qDebug() << "CartesianAxis::paint( QPainter* painter ) " << " areaGeometry()():" << rect << " sizeHint():" << sizeHint(); 00241 00242 ctx.setRectangle( 00243 QRectF ( 00244 //QPointF(0, 0), 00245 QPointF(rect.left(), rect.top()), 00246 QSizeF(rect.width(), rect.height() ) ) ); 00247 // enabling clipping so that we're not drawing outside 00248 QRegion clipRegion( rect.adjusted( -1, -1, 1, 1 ) ); 00249 painter->save(); 00250 painter->setClipRegion( clipRegion ); 00251 paintCtx( &ctx ); 00252 painter->restore(); 00253 //qDebug() << "KDChart::CartesianAxis::paint() done."; 00254 }
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 LeveyJenningsAxis::paintAsAbscissa | ( | PaintContext * | context | ) | [protected, virtual] |
Definition at line 217 of file KDChartLeveyJenningsAxis.cpp.
References KDChart::CartesianAxis::Bottom, KDChart::PaintContext::coordinatePlane(), d, dateFormat(), KDChart::CartesianAxis::geometry(), KDChart::CartesianAxis::isAbscissa(), KDChart::TextAttributes::isVisible(), KDChartEnums::MeasureOrientationMinimum, KDChart::CartesianAxis::paintCtx(), KDChart::PaintContext::painter(), KDChart::AbstractCoordinatePlane::parent(), KDChart::CartesianAxis::position(), KDChart::AbstractAxis::setLabels(), KDChart::AbstractAxis::textAttributes(), and KDChart::LeveyJenningsDiagram::timeRange().
Referenced by paintCtx().
00218 { 00219 Q_ASSERT( isAbscissa() ); 00220 00221 // this triggers drawing of the ticks 00222 setLabels( QStringList() << QString::fromLatin1( " " ) ); 00223 CartesianAxis::paintCtx( context ); 00224 00225 const LeveyJenningsDiagram* const diag = dynamic_cast< const LeveyJenningsDiagram* >( d->diagram() ); 00226 LeveyJenningsCoordinatePlane* plane = dynamic_cast<LeveyJenningsCoordinatePlane*>(context->coordinatePlane()); 00227 00228 const QObject* referenceArea = plane->parent(); 00229 const TextAttributes labelTA = textAttributes(); 00230 00231 const bool drawLabels = labelTA.isVisible(); 00232 00233 if( !drawLabels ) 00234 return; 00235 00236 00237 const QPair< QDateTime, QDateTime > range = diag->timeRange(); 00238 00239 QPainter* const painter = context->painter(); 00240 const PainterSaver ps( painter ); 00241 painter->setRenderHint( QPainter::Antialiasing, true ); 00242 painter->setClipping( false ); 00243 00244 00245 TextLayoutItem labelItem( range.first.date().toString( dateFormat() ), 00246 labelTA, 00247 referenceArea, 00248 KDChartEnums::MeasureOrientationMinimum, 00249 Qt::AlignLeft ); 00250 QSize origSize = labelItem.sizeHint(); 00251 if( range.first.secsTo( range.second ) < 86400 ) 00252 labelItem = TextLayoutItem( range.first.toString( dateFormat() ), 00253 labelTA, 00254 referenceArea, 00255 KDChartEnums::MeasureOrientationMinimum, 00256 Qt::AlignLeft ); 00257 QSize size = labelItem.sizeHint(); 00258 00259 float yPos = position() == Bottom ? geometry().bottom() - size.height() : geometry().top(); 00260 labelItem.setGeometry( QRectF( QPointF( geometry().left() - origSize.width() / 2.0, yPos ), size ).toRect() ); 00261 labelItem.paint( painter ); 00262 00263 00264 TextLayoutItem labelItem2( range.second.date().toString( dateFormat() ), 00265 labelTA, 00266 referenceArea, 00267 KDChartEnums::MeasureOrientationMinimum, 00268 Qt::AlignLeft ); 00269 origSize = labelItem2.sizeHint(); 00270 if( range.first.secsTo( range.second ) < 86400 ) 00271 labelItem2 = TextLayoutItem( range.second.toString( dateFormat() ), 00272 labelTA, 00273 referenceArea, 00274 KDChartEnums::MeasureOrientationMinimum, 00275 Qt::AlignLeft ); 00276 size = labelItem2.sizeHint(); 00277 yPos = position() == Bottom ? geometry().bottom() - size.height() : geometry().top(); 00278 labelItem2.setGeometry( QRectF( QPointF( geometry().right() - size.width() + origSize.width() / 2.0, yPos ), size ).toRect() ); 00279 labelItem2.paint( painter ); 00280 }
void LeveyJenningsAxis::paintAsOrdinate | ( | PaintContext * | context | ) | [protected, virtual] |
Definition at line 156 of file KDChartLeveyJenningsAxis.cpp.
References KDChart::LeveyJenningsDiagram::calculatedMeanValue(), KDChart::LeveyJenningsDiagram::calculatedStandardDeviation(), KDChart::PaintContext::coordinatePlane(), KDChart::AbstractAxis::customizedLabel(), d, KDChart::LeveyJenningsGridAttributes::Expected, KDChart::LeveyJenningsDiagram::expectedMeanValue(), KDChart::LeveyJenningsDiagram::expectedStandardDeviation(), KDChart::CartesianAxis::geometry(), KDChart::CartesianAxis::isOrdinate(), KDChart::TextAttributes::isVisible(), KDChart::AbstractAxis::labels(), KDChart::CartesianAxis::Left, KDChartEnums::MeasureOrientationMinimum, KDChart::PaintContext::painter(), KDChart::AbstractCoordinatePlane::parent(), KDChart::TextAttributes::pen(), KDChart::CartesianAxis::position(), KDChart::PrintingParameters::scalePen(), KDChart::AbstractAxis::textAttributes(), KDChart::CartesianCoordinatePlane::translate(), and type().
Referenced by paintCtx().
00157 { 00158 const LeveyJenningsDiagram* const diag = dynamic_cast< const LeveyJenningsDiagram* >( d->diagram() ); 00159 00160 Q_ASSERT( isOrdinate() ); 00161 LeveyJenningsCoordinatePlane* plane = dynamic_cast<LeveyJenningsCoordinatePlane*>(context->coordinatePlane()); 00162 00163 const qreal meanValue = type() == LeveyJenningsGridAttributes::Expected ? diag->expectedMeanValue() 00164 : diag->calculatedMeanValue(); 00165 const qreal standardDeviation = type() == LeveyJenningsGridAttributes::Expected ? diag->expectedStandardDeviation() 00166 : diag->calculatedStandardDeviation(); 00167 const TextAttributes labelTA = textAttributes(); 00168 const bool drawLabels = labelTA.isVisible(); 00169 00170 // nothing to draw, since we've no ticks 00171 if( !drawLabels ) 00172 return; 00173 00174 const QObject* referenceArea = plane->parent(); 00175 00176 const QVector< qreal > values = QVector< qreal >() << ( meanValue - 3 * standardDeviation ) 00177 << ( meanValue - 2 * standardDeviation ) 00178 << ( meanValue ) 00179 << ( meanValue + 2 * standardDeviation ) 00180 << ( meanValue + 3 * standardDeviation ); 00181 00182 Q_ASSERT_X( values.count() <= labels().count(), "LeveyJenningsAxis::paintAsOrdinate", "Need to have at least 5 labels" ); 00183 00184 TextLayoutItem labelItem( tr( "mean" ), 00185 labelTA, 00186 referenceArea, 00187 KDChartEnums::MeasureOrientationMinimum, 00188 Qt::AlignLeft ); 00189 00190 QPainter* const painter = context->painter(); 00191 const PainterSaver ps( painter ); 00192 painter->setRenderHint( QPainter::Antialiasing, true ); 00193 painter->setClipping( false ); 00194 00195 painter->setPen ( PrintingParameters::scalePen( labelTA.pen() ) ); // perhaps we want to add a setter method later? 00196 00197 for( int i = 0; i < values.count(); ++i ) 00198 { 00199 const QPointF labelPos = plane->translate( QPointF( 0.0, values.at( i ) ) ); 00200 const QString label = customizedLabel( labels().at( i ) ); 00201 labelItem.setText( label ); 00202 const QSize size = labelItem.sizeHint(); 00203 const float xPos = position() == Left ? geometry().right() - size.width() : geometry().left(); 00204 labelItem.setGeometry( QRectF( QPointF( xPos, labelPos.y() - size.height() / 2.0 ), size ).toRect() ); 00205 00206 // don't draw labels which aren't in the valid range (might happen for calculated SDs) 00207 if( values.at( i ) > diag->expectedMeanValue() + 4 * diag->expectedStandardDeviation() ) 00208 continue; 00209 00210 if( values.at( i ) < diag->expectedMeanValue() - 4 * diag->expectedStandardDeviation() ) 00211 continue; 00212 00213 labelItem.paint( painter ); 00214 } 00215 }
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 LeveyJenningsAxis::paintCtx | ( | PaintContext * | context | ) | [virtual] |
reimpl
Reimplemented from KDChart::CartesianAxis.
Definition at line 135 of file KDChartLeveyJenningsAxis.cpp.
References KDChart::PaintContext::coordinatePlane(), d, KDChart::CartesianAxis::isOrdinate(), paintAsAbscissa(), and paintAsOrdinate().
00136 { 00137 00138 Q_ASSERT_X ( d->diagram(), "LeveyJenningsAxis::paint", 00139 "Function call not allowed: The axis is not assigned to any diagram." ); 00140 00141 LeveyJenningsCoordinatePlane* plane = dynamic_cast<LeveyJenningsCoordinatePlane*>(context->coordinatePlane()); 00142 Q_ASSERT_X ( plane, "LeveyJenningsAxis::paint", 00143 "Bad function call: PaintContext::coodinatePlane() NOT a levey jennings plane." ); 00144 00145 // note: Not having any data model assigned is no bug 00146 // but we can not draw an axis then either. 00147 if( ! d->diagram()->model() ) 00148 return; 00149 00150 if( isOrdinate() ) 00151 paintAsOrdinate( context ); 00152 else 00153 paintAsAbscissa( context ); 00154 }
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] |
const CartesianAxis::Position CartesianAxis::position | ( | ) | const [virtual, inherited] |
Definition at line 153 of file KDChartCartesianAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::compare(), KDChart::CartesianAxis::expandingDirections(), KDChart::CartesianAxis::isAbscissa(), KDChart::CartesianAxis::isOrdinate(), paintAsAbscissa(), paintAsOrdinate(), KDChart::CartesianAxis::paintCtx(), and KDChart::CartesianAxis::tickLength().
00154 { 00155 return d->position; 00156 }
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 }
void CartesianAxis::resetTitleTextAttributes | ( | ) | [inherited] |
Reset the title text attributes to the built-in default:.
Same font and pen as AbstractAxis::textAttributes() and 1.5 times their size.
Definition at line 132 of file KDChartCartesianAxis.cpp.
References d, and KDChart::CartesianAxis::layoutPlanes().
00133 { 00134 d->useDefaultTextAttributes = true; 00135 layoutPlanes(); 00136 }
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::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 [inherited] |
Returns the attributes to be used for painting the rulers.
Definition at line 270 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::paintCtx().
00271 { 00272 return d->rulerAttributes; 00273 }
void CartesianAxis::setAnnotations | ( | const QMap< double, QString > & | annotations | ) | [inherited] |
Sets the axis annotations to annotations.
Annotations are a QMap of doubles and QStrings defining special markers and their position. If you use annotations, the normal ticks and values will be invisible. To unset the annotations, pass an empty QMap.
Definition at line 1774 of file KDChartCartesianAxis.cpp.
References d, and KDChart::AbstractAxis::update().
01775 { 01776 if( d->annotations == annotations ) 01777 return; 01778 01779 d->annotations = annotations; 01780 update(); 01781 }
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 CartesianAxis::setCachedSizeDirty | ( | ) | const [slot, inherited] |
Definition at line 1446 of file KDChartCartesianAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::setGeometry().
01447 { 01448 d->cachedMaximumSize = QSize(); 01449 }
void LeveyJenningsAxis::setDateFormat | ( | Qt::DateFormat | format | ) |
Definition at line 119 of file KDChartLeveyJenningsAxis.cpp.
References d.
00120 { 00121 d->format = format; 00122 }
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 }
void CartesianAxis::setGeometry | ( | const QRect & | r | ) | [virtual, inherited] |
pure virtual in QLayoutItem
Implements KDChart::AbstractAxis.
Definition at line 1740 of file KDChartCartesianAxis.cpp.
References d, and KDChart::CartesianAxis::setCachedSizeDirty().
01741 { 01742 // qDebug() << "KDChart::CartesianAxis::setGeometry(" << r << ") called" 01743 // << (isAbscissa() ? "for Abscissa":"for Ordinate") << "axis"; 01744 d->geometry = r; 01745 setCachedSizeDirty(); 01746 }
void AbstractAxis::setLabels | ( | const QStringList & | list | ) | [inherited] |
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.
Definition at line 292 of file KDChartAbstractAxis.cpp.
References d, and KDChart::AbstractAxis::update().
Referenced by paintAsAbscissa().
00293 { 00294 if( d->hardLabels == list ) 00295 return; 00296 00297 d->hardLabels = list; 00298 update(); 00299 }
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 65 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::HeaderFooter::setParent(), and KDChart::AbstractCartesianDiagram::takeAxis().
00066 { 00067 mParent = widget; 00068 }
void CartesianAxis::setPosition | ( | Position | p | ) | [virtual, inherited] |
Definition at line 144 of file KDChartCartesianAxis.cpp.
References d, and KDChart::CartesianAxis::layoutPlanes().
00145 { 00146 d->position = p; 00147 layoutPlanes(); 00148 }
void AbstractAxis::setRulerAttributes | ( | const RulerAttributes & | a | ) | [inherited] |
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.
Definition at line 259 of file KDChartAbstractAxis.cpp.
References d, and KDChart::AbstractAxis::update().
void AbstractAxis::setShortLabels | ( | const QStringList & | list | ) | [inherited] |
Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long.
Definition at line 322 of file KDChartAbstractAxis.cpp.
References d, and KDChart::AbstractAxis::update().
00323 { 00324 if( d->hardShortLabels == list ) 00325 return; 00326 00327 d->hardShortLabels = list; 00328 update(); 00329 }
void AbstractAxis::setTextAttributes | ( | const TextAttributes & | a | ) | [inherited] |
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.
Definition at line 231 of file KDChartAbstractAxis.cpp.
References d, and KDChart::AbstractAxis::update().
Referenced by setType().
00232 { 00233 if( d->textAttributes == a ) 00234 return; 00235 00236 d->textAttributes = a; 00237 update(); 00238 }
void CartesianAxis::setTitleText | ( | const QString & | text | ) | [inherited] |
Definition at line 102 of file KDChartCartesianAxis.cpp.
References d, and KDChart::CartesianAxis::layoutPlanes().
00103 { 00104 d->titleText = text; 00105 layoutPlanes(); 00106 }
void CartesianAxis::setTitleTextAttributes | ( | const TextAttributes & | a | ) | [inherited] |
Definition at line 113 of file KDChartCartesianAxis.cpp.
References d, and KDChart::CartesianAxis::layoutPlanes().
00114 { 00115 d->titleTextAttributes = a; 00116 d->useDefaultTextAttributes = false; 00117 layoutPlanes(); 00118 }
void LeveyJenningsAxis::setType | ( | LeveyJenningsGridAttributes::GridType | type | ) |
Sets the type of the axis to type.
This method colors the label to the default color of the respective type. Please make sure to re-set the colors after calling this, if you want them different. Setting the type is only valid for axes located right or left from the diagram. An axis on the bottom always shows the timeline.
Definition at line 95 of file KDChartLeveyJenningsAxis.cpp.
References d, KDChart::LeveyJenningsGridAttributes::Expected, KDChart::TextAttributes::pen(), KDChart::TextAttributes::setPen(), KDChart::AbstractAxis::setTextAttributes(), and KDChart::AbstractAxis::textAttributes().
00096 { 00097 if( type != d->type ) 00098 { 00099 TextAttributes ta = textAttributes(); 00100 QPen pen = ta.pen(); 00101 QColor color = type == LeveyJenningsGridAttributes::Expected ? Qt::black : Qt::blue; 00102 if( qobject_cast< const LeveyJenningsDiagram* >( d->diagram() ) && 00103 qobject_cast< const LeveyJenningsCoordinatePlane* >( d->diagram()->coordinatePlane() ) ) 00104 { 00105 color = qobject_cast< const LeveyJenningsCoordinatePlane* >( d->diagram()->coordinatePlane() )->gridAttributes().gridPen( type ).color(); 00106 } 00107 pen.setColor( color ); 00108 ta.setPen( pen ); 00109 setTextAttributes( ta ); 00110 } 00111 d->type = type; 00112 }
QStringList AbstractAxis::shortLabels | ( | ) | const [inherited] |
Returns a list of strings, that are used as axis labels, as set via setShortLabels.
Definition at line 339 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::AbstractAxis::compare(), and KDChart::CartesianAxis::paintCtx().
00340 { 00341 return d->hardShortLabels; 00342 }
QSize CartesianAxis::sizeHint | ( | ) | const [virtual, inherited] |
pure virtual in QLayoutItem
Definition at line 1735 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::maximumSize().
01736 { 01737 return maximumSize(); 01738 }
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 [inherited] |
Returns the text attributes to be used for axis labels.
Definition at line 245 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::AbstractAxis::compare(), paintAsAbscissa(), paintAsOrdinate(), KDChart::CartesianAxis::paintCtx(), setType(), and KDChart::CartesianAxis::titleTextAttributes().
00246 { 00247 return d->textAttributes; 00248 }
int CartesianAxis::tickLength | ( | bool | subUnitTicks = false |
) | const [slot, inherited] |
Definition at line 1753 of file KDChartCartesianAxis.cpp.
References KDChart::CartesianAxis::isAbscissa(), KDChart::CartesianAxis::Left, KDChart::CartesianAxis::position(), and KDChart::CartesianAxis::Top.
Referenced by KDChart::CartesianAxis::paintCtx().
01754 { 01755 int result = 0; 01756 01757 if ( isAbscissa() ) { 01758 result = position() == Top ? -4 : 3; 01759 } else { 01760 result = position() == Left ? -4 : 3; 01761 } 01762 01763 if ( subUnitTicks ) 01764 result = result < 0 ? result + 1 : result - 1; 01765 01766 return result; 01767 }
QString CartesianAxis::titleText | ( | ) | const [inherited] |
Definition at line 108 of file KDChartCartesianAxis.cpp.
References d.
Referenced by KDChart::CartesianAxis::compare(), and KDChart::CartesianAxis::paintCtx().
00109 { 00110 return d->titleText; 00111 }
TextAttributes CartesianAxis::titleTextAttributes | ( | ) | const [inherited] |
Returns the text attributes that will be used for displaying the title text.
This is either the text attributes as specified by setTitleTextAttributes, or (if setTitleTextAttributes() was not called) the default text attributes.
Definition at line 120 of file KDChartCartesianAxis.cpp.
References d, KDChart::TextAttributes::fontSize(), KDChart::CartesianAxis::hasDefaultTitleTextAttributes(), KDChart::TextAttributes::setFontSize(), and KDChart::AbstractAxis::textAttributes().
Referenced by KDChart::CartesianAxis::compare().
00121 { 00122 if( hasDefaultTitleTextAttributes() ){ 00123 TextAttributes ta( textAttributes() ); 00124 Measure me( ta.fontSize() ); 00125 me.setValue( me.value() * 1.5 ); 00126 ta.setFontSize( me ); 00127 return ta; 00128 } 00129 return d->titleTextAttributes; 00130 }
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::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 }
LeveyJenningsGridAttributes::GridType LeveyJenningsAxis::type | ( | ) | const |
Definition at line 81 of file KDChartLeveyJenningsAxis.cpp.
References d.
Referenced by compare(), and paintAsOrdinate().
00082 { 00083 return d->type; 00084 }
void KDChart::AbstractAxis::update | ( | ) | [slot, inherited] |
Definition at line 366 of file KDChartAbstractAxis.cpp.
References d.
Referenced by KDChart::AbstractAxis::connectSignals(), KDChart::CartesianAxis::setAnnotations(), KDChart::AbstractAxis::setLabels(), KDChart::AbstractAxis::setRulerAttributes(), KDChart::AbstractAxis::setShortLabels(), and KDChart::AbstractAxis::setTextAttributes().
QWidget* KDChart::AbstractLayoutItem::mParent [protected, inherited] |
QLayout* KDChart::AbstractLayoutItem::mParentLayout [protected, inherited] |
Definition at line 94 of file KDChartLayoutItems.h.
Referenced by KDChart::AutoSpacerLayoutItem::paint().