KDChart::PieDiagram Class Reference

#include <KDChartPieDiagram.h>

Inheritance diagram for KDChart::PieDiagram:

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

Collaboration graph
[legend]

List of all members.


Detailed Description

PieDiagram defines a common pie diagram.

Definition at line 43 of file KDChartPieDiagram.h.


Signals

void dataHidden ()
 This signal is emitted, when the hidden status of at least one data cell was (un)set.
void layoutChanged (AbstractDiagram *)
 Diagrams are supposed to emit this signal, when the layout of one of their element changes.
void modelsChanged ()
 This signal is emitted, when either the model or the AttributesModel is replaced.
void propertiesChanged ()
 Emitted upon change of a property of the Diagram.

Public Member Functions

bool allowOverlappingDataValueTexts () const
 
Returns:
Whether data value labels are allowed to overlap.

bool antiAliasing () const
 
Returns:
Whether anti-aliasing is to be used for rendering this diagram.

virtual AttributesModelattributesModel () const
 Returns the AttributesModel, that is used by this diagram.
QBrush brush (const QModelIndex &index) const
 Retrieve the brush to be used, for painting the datapoint at the given index in the model.
QBrush brush (int dataset) const
 Retrieve the brush to be used for the given dataset.
QBrush brush () const
 Retrieve the brush to be used for painting datapoints globally.
virtual PieDiagramclone () const
 Creates an exact copy of this diagram.
int columnCount () const
bool compare (const AbstractDiagram *other) const
 Returns true if both diagrams have the same settings.
bool compare (const AbstractPieDiagram *other) const
 Returns true if both diagrams have the same settings.
AbstractCoordinatePlanecoordinatePlane () const
 The coordinate plane associated with the diagram.
const QPair< QPointF, QPointF > dataBoundaries () const
 Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these values).
virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 [reimplemented]
QList< QBrush > datasetBrushes () const
 The set of dataset brushes currently used, for use in legends, etc.
int datasetDimension () const
 The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to have.
QStringList datasetLabels () const
 The set of dataset labels currently displayed, for use in legends, etc.
QList< MarkerAttributesdatasetMarkers () const
 The set of dataset markers currently used, for use in legends, etc.
QList< QPen > datasetPens () const
 The set of dataset pens currently used, for use in legends, etc.
DataValueAttributes dataValueAttributes (const QModelIndex &index) const
 Retrieve the DataValueAttributes for the given index.
DataValueAttributes dataValueAttributes (int dataset) const
 Retrieve the DataValueAttributes for the given dataset.
DataValueAttributes dataValueAttributes () const
 Retrieve the DataValueAttributes specified globally.
virtual void doItemsLayout ()
 [reimplemented]
qreal granularity () const
 
Returns:
the granularity.

virtual int horizontalOffset () const
 [reimplemented]
virtual QModelIndex indexAt (const QPoint &point) const
 [reimplemented]
QModelIndexList indexesAt (const QPoint &point) const
 This method is added alongside with indexAt from QAIM, since in kdchart multiple indexes can be displayed at the same spot.
bool isHidden (const QModelIndex &index) const
 Retrieve the hidden status for the given index.
bool isHidden (int dataset) const
 Retrieve the hidden status for the given dataset.
bool isHidden () const
 Retrieve the hidden status specified globally.
virtual bool isIndexHidden (const QModelIndex &index) const
 [reimplemented]
QStringList itemRowLabels () const
 The set of item row labels currently displayed, for use in Abscissa axes, etc.
virtual QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
 [reimplemented]
virtual double numberOfDatasets () const
virtual double numberOfGridRings () const
 [reimplemented]
virtual double numberOfValuesPerDataset () const
 [reimplemented]
void paintDataValueText (QPainter *painter, const QModelIndex &index, const QPointF &pos, double value)
void paintMarker (QPainter *painter, const QModelIndex &index, const QPointF &pos)
void paintMarker (QPainter *painter, const DataValueAttributes &a, const QModelIndex &index, const QPointF &pos)
virtual void paintMarker (QPainter *painter, const MarkerAttributes &markerAttributes, const QBrush &brush, const QPen &, const QPointF &point, const QSizeF &size)
QPen pen (const QModelIndex &index) const
 Retrieve the pen to be used, for painting the datapoint at the given index in the model.
QPen pen (int dataset) const
 Retrieve the pen to be used for the given dataset.
QPen pen () const
 Retrieve the pen to be used for painting datapoints globally.
bool percentMode () const
PieAttributes pieAttributes (const QModelIndex &index) const
PieAttributes pieAttributes (int column) const
PieAttributes pieAttributes () const
 PieDiagram (QWidget *parent=0, PolarCoordinatePlane *plane=0)
const PolarCoordinatePlanepolarCoordinatePlane () const
virtual void resize (const QSizeF &area)
 [reimplemented]
int rowCount () const
virtual void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible)
 [reimplemented]
void setAllowOverlappingDataValueTexts (bool allow)
 Set whether data value labels are allowed to overlap.
void setAntiAliasing (bool enabled)
 Set whether anti-aliasing is to be used while rendering this diagram.
virtual void setAttributesModel (AttributesModel *model)
 Associate an AttributesModel with this diagram.
void setBrush (const QBrush &brush)
 Set the brush to be used, for painting all datasets in the model.
void setBrush (int dataset, const QBrush &brush)
 Set the brush to be used, for painting the given dataset.
void setBrush (const QModelIndex &index, const QBrush &brush)
 Set the brush to be used, for painting the datapoint at the given index.
virtual void setCoordinatePlane (AbstractCoordinatePlane *plane)
 Set the coordinate plane associated with the diagram.
void setDatasetDimension (int dimension)
 
void setDataValueAttributes (const DataValueAttributes &a)
 Set the DataValueAttributes for all datapoints in the model.
void setDataValueAttributes (int dataset, const DataValueAttributes &a)
 Set the DataValueAttributes for the given dataset.
void setDataValueAttributes (const QModelIndex &index, const DataValueAttributes &a)
 Set the DataValueAttributes for the given index.
void setGranularity (qreal value)
 Set the granularity: the smaller the granularity the more your diagram segments will show facettes instead of rounded segments.
void setHidden (bool hidden)
 Hide (or unhide, resp.
void setHidden (int dataset, bool hidden)
 Hide (or unhide, resp.
void setHidden (const QModelIndex &index, bool hidden)
 Hide (or unhide, resp.
virtual void setModel (QAbstractItemModel *model)
 Associate a model with the diagram.
void setPen (const QPen &pen)
 Set the pen to be used, for painting all datasets in the model.
void setPen (int dataset, const QPen &pen)
 Set the pen to be used, for painting the given dataset.
void setPen (const QModelIndex &index, const QPen &pen)
 Set the pen to be used, for painting the datapoint at the given index.
void setPercentMode (bool percent)
void setPieAttributes (const QModelIndex &index, const PieAttributes &a)
void setPieAttributes (int column, const PieAttributes &a)
void setPieAttributes (const PieAttributes &a)
virtual void setRootIndex (const QModelIndex &idx)
 Set the root index in the model, where the diagram starts referencing data for display.
virtual void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command)
 [reimplemented]
virtual void setSelectionModel (QItemSelectionModel *selectionModel)
 Associate a seleection model with the diagrom.
void setStartPosition (int degrees)
void setThreeDPieAttributes (const QModelIndex &index, const ThreeDPieAttributes &a)
void setThreeDPieAttributes (int column, const ThreeDPieAttributes &a)
void setThreeDPieAttributes (const ThreeDPieAttributes &a)
void setUnitPrefix (const QString &prefix, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for all columns.
void setUnitPrefix (const QString &prefix, int column, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for one specific column.
void setUnitSuffix (const QString &suffix, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for all columns.
void setUnitSuffix (const QString &suffix, int column, Qt::Orientation orientation)
 Set the unit prefix to be used on axes for one specific column.
int startPosition () const
ThreeDPieAttributes threeDPieAttributes (const QModelIndex &index) const
ThreeDPieAttributes threeDPieAttributes (int column) const
ThreeDPieAttributes threeDPieAttributes () const
QString unitPrefix (Qt::Orientation orientation) const
 Retrieves the axis unit prefix.
QString unitPrefix (int column, Qt::Orientation orientation, bool fallback=false) const
 Retrieves the axis unit prefix for a specific column.
QString unitSuffix (Qt::Orientation orientation) const
 Retrieves the axis unit suffix.
QString unitSuffix (int column, Qt::Orientation orientation, bool fallback=false) const
 Retrieves the axis unit suffix for a specific column.
void update () const
void useDefaultColors ()
 Set the palette to be used, for painting datasets to the default palette.
void useRainbowColors ()
 Set the palette to be used, for painting datasets to the rainbow palette.
virtual bool usesExternalAttributesModel () const
 Returns whether the diagram is using its own built-in attributes model or an attributes model that was set via setAttributesModel.
void useSubduedColors ()
 Set the palette to be used, for painting datasets to the subdued palette.
virtual double valueTotals () const
 [reimplemented]
virtual int verticalOffset () const
 [reimplemented]
virtual QRect visualRect (const QModelIndex &index) const
 [reimplemented]
virtual QRegion visualRegion (const QModelIndex &index) const
virtual QRegion visualRegionForSelection (const QItemSelection &selection) const
 [reimplemented]
virtual ~PieDiagram ()

Protected Slots

void setDataBoundariesDirty () const

Protected Member Functions

QModelIndex attributesModelRootIndex () const
virtual const QPair< QPointF,
QPointF > 
calculateDataBoundaries () const
 [reimplemented]
virtual bool checkInvariants (bool justReturnTheStatus=false) const
virtual void paint (PaintContext *paintContext)
 [reimplemented]
virtual void paintDataValueTexts (QPainter *painter)
 This method is obsolete and provided for backward-compatibility only.
void paintEvent (QPaintEvent *)
void paintInternal (PaintContext *paintContext, QRectF &textBoundingRect)
virtual void paintMarkers (QPainter *painter)
 This method is obsolete and provided for backward-compatibility only.
void resizeEvent (QResizeEvent *)
void setAttributesModelRootIndex (const QModelIndex &)
void setDatasetDimensionInternal (int dimension)
double valueForCell (int row, int column) const
 Helper method, retrieving the data value (DisplayRole) for a given row and column.

Constructor & Destructor Documentation

PieDiagram::PieDiagram ( QWidget parent = 0,
PolarCoordinatePlane plane = 0 
) [explicit]

Definition at line 54 of file KDChartPieDiagram.cpp.

References StockDiagram::init().

Referenced by clone().

00054                                                                      :
00055     AbstractPieDiagram( new Private(), parent, plane )
00056 {
00057     init();
00058 }

PieDiagram::~PieDiagram (  )  [virtual]

Definition at line 60 of file KDChartPieDiagram.cpp.

00061 {
00062 }


Member Function Documentation

bool AbstractDiagram::allowOverlappingDataValueTexts (  )  const [inherited]

Returns:
Whether data value labels are allowed to overlap.

Definition at line 511 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::compare().

00512 {
00513     return d->allowOverlappingDataValueTexts;
00514 }

bool AbstractDiagram::antiAliasing (  )  const [inherited]

Returns:
Whether anti-aliasing is to be used for rendering this diagram.

Definition at line 522 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::compare().

00523 {
00524     return d->antiAliasing;
00525 }

AttributesModel * AbstractDiagram::attributesModel (  )  const [virtual, inherited]

Returns the AttributesModel, that is used by this diagram.

By default each diagram owns its own AttributesModel, which should never be deleted. Only if a user-supplied AttributesModel has been set does the pointer returned here not belong to the diagram.

Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
Returns:
a pointer to the AttributesModel currently used by this diagram.

Definition at line 315 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::brush(), StockDiagram::calculateDataBoundaries(), KDChart::AbstractDiagram::compare(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), KDChart::AbstractDiagram::dataValueAttributes(), StockDiagram::init(), KDChart::AbstractDiagram::isHidden(), KDChart::AbstractDiagram::itemRowLabels(), StockDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::pen(), KDChart::AbstractCartesianDiagram::setAttributesModel(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), KDChart::AbstractCartesianDiagram::setCoordinatePlane(), KDChart::AbstractCartesianDiagram::setModel(), KDChart::AbstractDiagram::setPen(), KDChart::AbstractCartesianDiagram::setRootIndex(), StockDiagram::setStockBarAttributes(), StockDiagram::setThreeDBarAttributes(), StockDiagram::stockBarAttributes(), KDChart::TernaryLineDiagram::TernaryLineDiagram(), and StockDiagram::threeDBarAttributes().

00316 {
00317     return d->attributesModel;
00318 }

QModelIndex AbstractDiagram::attributesModelRootIndex (  )  const [protected, inherited]

returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.

Definition at line 345 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by StockDiagram::calculateDataBoundaries(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), KDChart::AbstractDiagram::itemRowLabels(), KDChart::Plotter::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::BarDiagram::numberOfAbscissaSegments(), KDChart::Plotter::numberOfOrdinateSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(), KDChart::BarDiagram::numberOfOrdinateSegments(), StockDiagram::paint(), KDChart::AbstractDiagram::valueForCell(), and KDChart::LineDiagram::valueForCellTesting().

00346 {
00347     if ( !d->attributesModelRootIndex.isValid() )
00348         d->attributesModelRootIndex = d->attributesModel->mapFromSource( rootIndex() );
00349     return d->attributesModelRootIndex;
00350 }

QBrush AbstractDiagram::brush ( const QModelIndex &  index  )  const [inherited]

Retrieve the brush to be used, for painting the datapoint at the given index in the model.

Parameters:
index The index of the datapoint in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
Returns:
The brush to use for painting.

Definition at line 850 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetBrushRole.

00851 {
00852     return qVariantValue<QBrush>(
00853         attributesModel()->data( conditionallyMapFromSource( index ), DatasetBrushRole ) );
00854 }

QBrush AbstractDiagram::brush ( int  dataset  )  const [inherited]

Retrieve the brush to be used for the given dataset.

This will fall back automatically to what was set at model level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.

Definition at line 835 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::brush(), KDChart::DatasetBrushRole, and KDChart::AbstractDiagram::datasetDimension().

00836 {
00837     // To store the brush for a dataset, we use the first column
00838     // that's associated with it. (i.e., with a dataset dimension
00839     // of two, the column of the keys)
00840     const int column = dataset * datasetDimension();
00841     
00842     const QVariant brushSettings(
00843             attributesModel()->headerData( column, Qt::Vertical,
00844                     DatasetBrushRole ) );
00845     if( brushSettings.isValid() )
00846         return qVariantValue< QBrush >( brushSettings );
00847     return brush();
00848 }

QBrush AbstractDiagram::brush (  )  const [inherited]

Retrieve the brush to be used for painting datapoints globally.

This will fall back automatically to the default settings, if there are no specific settings.

Returns:
The brush to use for painting.

Definition at line 829 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetBrushRole.

Referenced by KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::PolarDiagram::paint(), and KDChart::AbstractDiagram::paintMarker().

00830 {
00831     return qVariantValue<QBrush>(
00832         attributesModel()->data( DatasetBrushRole ) );
00833 }

const QPair< QPointF, QPointF > PieDiagram::calculateDataBoundaries (  )  const [protected, virtual]

[reimplemented]

Implements KDChart::AbstractDiagram.

Definition at line 76 of file KDChartPieDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractPolarDiagram::columnCount(), KDChart::PieAttributes::explodeFactor(), and KDChart::AbstractPieDiagram::pieAttributes().

00077 {
00078     if ( !checkInvariants( true ) ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) );
00079 
00080     const PieAttributes attrs( pieAttributes( model()->index( 0, 0, rootIndex() ) ) );
00081 
00082     QPointF bottomLeft ( QPointF( 0, 0 ) );
00083     QPointF topRight;
00084     // If we explode, we need extra space for the pie slice that has
00085     // the largest explosion distance.
00086     if ( attrs.explode() ) {
00087         const int colCount = columnCount();
00088         qreal maxExplode = 0.0;
00089         for( int j = 0; j < colCount; ++j ){
00090             const PieAttributes columnAttrs( pieAttributes( model()->index( 0, j, rootIndex() ) ) );
00091             maxExplode = qMax( maxExplode, columnAttrs.explodeFactor() );
00092         }
00093         topRight = QPointF( 1.0+maxExplode, 1.0+maxExplode );
00094     }else{
00095         topRight = QPointF( 1.0, 1.0 );
00096     }
00097     return QPair<QPointF, QPointF> ( bottomLeft,  topRight );
00098 }

bool AbstractDiagram::checkInvariants ( bool  justReturnTheStatus = false  )  const [protected, virtual, inherited]

Definition at line 1077 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::coordinatePlane().

Referenced by KDChart::RingDiagram::calculateDataBoundaries(), KDChart::PolarDiagram::calculateDataBoundaries(), KDChart::Plotter::calculateDataBoundaries(), calculateDataBoundaries(), KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculateDataBoundaries(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), KDChart::BarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), paintInternal(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractDiagram::paintMarkers().

01078 {
01079     if( ! justReturnTheStatus ){
01080         Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
01081                     "There is no usable model set, for the diagram." );
01082 
01083         Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
01084                     "There is no usable coordinate plane set, for the diagram." );
01085     }
01086     return model() && coordinatePlane();
01087 }

PieDiagram * PieDiagram::clone (  )  const [virtual]

Creates an exact copy of this diagram.

Definition at line 71 of file KDChartPieDiagram.cpp.

References d, PieDiagram(), and StockDiagram::Private::Private().

00072 {
00073     return new PieDiagram( new Private( *d ) );
00074 }

int AbstractPolarDiagram::columnCount (  )  const [inherited]

Definition at line 60 of file KDChartAbstractPolarDiagram.cpp.

References KDChart::AbstractPolarDiagram::numberOfValuesPerDataset().

Referenced by KDChart::RingDiagram::calculateDataBoundaries(), calculateDataBoundaries(), KDChart::RingDiagram::paint(), paintInternal(), KDChart::RingDiagram::valueTotals(), and valueTotals().

00061 {
00062     return static_cast<int>( numberOfValuesPerDataset() );
00063 }

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

Returns true if both diagrams have the same settings.

Definition at line 131 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::allowOverlappingDataValueTexts(), KDChart::AbstractDiagram::antiAliasing(), KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::compare(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::percentMode().

00132 {
00133     if( other == this ) return true;
00134     if( ! other ){
00135         //qDebug() << "AbstractDiagram::compare() cannot compare to Null pointer";
00136         return false;
00137     }
00138     /*
00139     qDebug() << "\n             AbstractDiagram::compare() QAbstractScrollArea:";
00140             // compare QAbstractScrollArea properties
00141     qDebug() <<
00142             ((horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) &&
00143             (verticalScrollBarPolicy()    == other->verticalScrollBarPolicy()));
00144     qDebug() << "AbstractDiagram::compare() QFrame:";
00145             // compare QFrame properties
00146     qDebug() <<
00147             ((frameShadow() == other->frameShadow()) &&
00148             (frameShape()   == other->frameShape()) &&
00149             (frameWidth()   == other->frameWidth()) &&
00150             (lineWidth()    == other->lineWidth()) &&
00151             (midLineWidth() == other->midLineWidth()));
00152     qDebug() << "AbstractDiagram::compare() QAbstractItemView:";
00153             // compare QAbstractItemView properties
00154     qDebug() <<
00155             ((alternatingRowColors() == other->alternatingRowColors()) &&
00156             (hasAutoScroll()         == other->hasAutoScroll()) &&
00157 #if QT_VERSION > 0x040199
00158             (dragDropMode()          == other->dragDropMode()) &&
00159             (dragDropOverwriteMode() == other->dragDropOverwriteMode()) &&
00160             (horizontalScrollMode()  == other->horizontalScrollMode ()) &&
00161             (verticalScrollMode()    == other->verticalScrollMode()) &&
00162 #endif
00163             (dragEnabled()           == other->dragEnabled()) &&
00164             (editTriggers()          == other->editTriggers()) &&
00165             (iconSize()              == other->iconSize()) &&
00166             (selectionBehavior()     == other->selectionBehavior()) &&
00167             (selectionMode()         == other->selectionMode()) &&
00168             (showDropIndicator()     == other->showDropIndicator()) &&
00169             (tabKeyNavigation()      == other->tabKeyNavigation()) &&
00170             (textElideMode()         == other->textElideMode()));
00171     qDebug() << "AbstractDiagram::compare() AttributesModel: ";
00172             // compare all of the properties stored in the attributes model
00173     qDebug() << attributesModel()->compare( other->attributesModel() );
00174     qDebug() << "AbstractDiagram::compare() own:";
00175             // compare own properties
00176     qDebug() <<
00177             ((rootIndex().column()            == other->rootIndex().column()) &&
00178             (rootIndex().row()                == other->rootIndex().row()) &&
00179             (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) &&
00180             (antiAliasing()                   == other->antiAliasing()) &&
00181             (percentMode()                    == other->percentMode()) &&
00182             (datasetDimension()               == other->datasetDimension()));
00183     */
00184     return  // compare QAbstractScrollArea properties
00185             (horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) &&
00186             (verticalScrollBarPolicy()   == other->verticalScrollBarPolicy()) &&
00187             // compare QFrame properties
00188             (frameShadow()  == other->frameShadow()) &&
00189             (frameShape()   == other->frameShape()) &&
00190 // frameWidth is a read-only property defined by the style, it should not be in here:
00191             // (frameWidth()   == other->frameWidth()) &&
00192             (lineWidth()    == other->lineWidth()) &&
00193             (midLineWidth() == other->midLineWidth()) &&
00194             // compare QAbstractItemView properties
00195             (alternatingRowColors()  == other->alternatingRowColors()) &&
00196             (hasAutoScroll()         == other->hasAutoScroll()) &&
00197 #if QT_VERSION > 0x040199
00198             (dragDropMode()          == other->dragDropMode()) &&
00199             (dragDropOverwriteMode() == other->dragDropOverwriteMode()) &&
00200             (horizontalScrollMode()  == other->horizontalScrollMode ()) &&
00201             (verticalScrollMode()    == other->verticalScrollMode()) &&
00202 #endif
00203             (dragEnabled()           == other->dragEnabled()) &&
00204             (editTriggers()          == other->editTriggers()) &&
00205             (iconSize()              == other->iconSize()) &&
00206             (selectionBehavior()     == other->selectionBehavior()) &&
00207             (selectionMode()         == other->selectionMode()) &&
00208             (showDropIndicator()     == other->showDropIndicator()) &&
00209             (tabKeyNavigation()      == other->tabKeyNavigation()) &&
00210             (textElideMode()         == other->textElideMode()) &&
00211             // compare all of the properties stored in the attributes model
00212             attributesModel()->compare( other->attributesModel() ) &&
00213             // compare own properties
00214             (rootIndex().column()             == other->rootIndex().column()) &&
00215             (rootIndex().row()                == other->rootIndex().row()) &&
00216             (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) &&
00217             (antiAliasing()                   == other->antiAliasing()) &&
00218             (percentMode()                    == other->percentMode()) &&
00219             (datasetDimension()               == other->datasetDimension());
00220 }

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

Returns true if both diagrams have the same settings.

Definition at line 63 of file KDChartAbstractPieDiagram.cpp.

References KDChart::AbstractPieDiagram::granularity(), and KDChart::AbstractPieDiagram::startPosition().

00064 {
00065     if( other == this ) return true;
00066     if( ! other ){
00067         //qDebug() << "AbstractPieDiagram::compare() cannot compare to Null pointer";
00068         return false;
00069     }
00070     /*
00071     qDebug() << "\n             AbstractPieDiagram::compare():";
00072             // compare own properties
00073     qDebug() <<
00074             (granularity() == other->granularity()) &&
00075             (startPosition() == other->startPosition());
00076     */
00077     return  // compare the base class
00078             ( static_cast<const AbstractPolarDiagram*>(this)->compare( other ) ) &&
00079             // compare own properties
00080             (granularity() == other->granularity()) &&
00081             (startPosition() == other->startPosition());
00082 }

AbstractCoordinatePlane * AbstractDiagram::coordinatePlane (  )  const [inherited]

The coordinate plane associated with the diagram.

This determines how coordinates in value space are mapped into pixel space. By default this is a CartesianCoordinatePlane.

Returns:
The coordinate plane associated with the diagram.

Definition at line 222 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::checkInvariants(), KDChart::LeveyJenningsDiagram::iconRect(), KDChart::AbstractCartesianDiagram::layoutPlanes(), KDChart::PolarDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarkers(), KDChart::AbstractPolarDiagram::polarCoordinatePlane(), StockDiagram::resize(), KDChart::Plotter::resize(), KDChart::LineDiagram::resize(), KDChart::BarDiagram::resize(), and KDChart::AbstractCartesianDiagram::setCoordinatePlane().

00223 {
00224     return d->plane;
00225 }

const QPair< QPointF, QPointF > AbstractDiagram::dataBoundaries (  )  const [inherited]

Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these values).

This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they can call setDataBoundariesDirty()

Returned value is in diagram coordinates.

Definition at line 227 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.

Referenced by KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), and KDChart::BarDiagram::paint().

00228 {
00229     if( d->databoundariesDirty ){
00230         d->databoundaries = calculateDataBoundaries ();
00231         d->databoundariesDirty = false;
00232     }
00233     return d->databoundaries;
00234 }

void AbstractDiagram::dataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
) [virtual, inherited]

[reimplemented]

Definition at line 366 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::LeveyJenningsDiagram::setModel().

00368 {
00369     Q_UNUSED( topLeft );
00370     Q_UNUSED( bottomRight );
00371     // We are still too dumb to do intelligent updates...
00372     setDataBoundariesDirty();
00373     scheduleDelayedItemsLayout();
00374 }

void KDChart::AbstractDiagram::dataHidden (  )  [signal, inherited]

This signal is emitted, when the hidden status of at least one data cell was (un)set.

Referenced by KDChart::AbstractDiagram::setHidden().

QList< QBrush > AbstractDiagram::datasetBrushes (  )  const [inherited]

The set of dataset brushes currently used, for use in legends, etc.

Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.

Definition at line 1038 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AbstractDiagram::brush(), KDChart::AttributesModel::columnCount(), and KDChart::AbstractDiagram::datasetDimension().

Referenced by KDChart::Legend::datasetCount(), and KDChart::Legend::setBrushesFromDiagram().

01039 {
01040     QList<QBrush> ret;
01041     if( model() == 0 )
01042         return ret;
01043 
01044     const int datasetCount = attributesModel()->columnCount(attributesModelRootIndex()) / datasetDimension();
01045     for ( int dataset = 0; dataset < datasetCount; dataset++ )
01046         ret << brush( dataset );
01047 
01048     return ret;
01049 }

int AbstractDiagram::datasetDimension (  )  const [inherited]

The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to have.

For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic values will be used for the abscissa.

For example a diagram with the default dimension of 1, will have one column per datapoint (the y values) and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y values.

Returns:
The dataset dimension of the diagram.

Definition at line 1089 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::compare(), KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::LineDiagram::getCellValues(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::AbstractDiagram::isHidden(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::AbstractDiagram::paintDataValueTexts(), KDChart::AbstractDiagram::paintMarkers(), KDChart::AbstractDiagram::pen(), KDChart::AbstractDiagram::setBrush(), KDChart::AbstractDiagram::setDataValueAttributes(), KDChart::AbstractDiagram::setHidden(), KDChart::AbstractDiagram::setPen(), KDChart::Plotter::setType(), and KDChart::LineDiagram::setType().

01090 {
01091     return d->datasetDimension;
01092 }

QStringList AbstractDiagram::datasetLabels (  )  const [inherited]

The set of dataset labels currently displayed, for use in legends, etc.

Returns:
The set of dataset labels currently displayed.

Definition at line 1025 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AttributesModel::headerData().

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

01026 {
01027     QStringList ret;
01028     if( model() == 0 )
01029         return ret;
01030     
01031     const int columnCount = attributesModel()->columnCount(attributesModelRootIndex());
01032     for( int i = 0; i < columnCount; i += datasetDimension() )
01033         ret << attributesModel()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString();
01034     
01035     return ret;
01036 }

QList< MarkerAttributes > AbstractDiagram::datasetMarkers (  )  const [inherited]

The set of dataset markers currently used, for use in legends, etc.

Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.

Definition at line 1064 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::dataValueAttributes(), and KDChart::DataValueAttributes::markerAttributes().

01065 {
01066     QList<MarkerAttributes> ret;
01067     if( model() == 0 )
01068         return ret;
01069     
01070     const int datasetCount = attributesModel()->columnCount(attributesModelRootIndex()) / datasetDimension();
01071     for ( int dataset = 0; dataset < datasetCount; dataset++ )
01072         ret << dataValueAttributes( dataset ).markerAttributes();
01073 
01074     return ret;
01075 }

QList< QPen > AbstractDiagram::datasetPens (  )  const [inherited]

The set of dataset pens currently used, for use in legends, etc.

Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.

Definition at line 1051 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::columnCount(), KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::pen().

01052 {
01053     QList<QPen> ret;
01054     if( model() == 0 )
01055         return ret;
01056     
01057     const int datasetCount = attributesModel()->columnCount(attributesModelRootIndex()) / datasetDimension();
01058     for ( int dataset = 0; dataset < datasetCount; dataset++ )
01059         ret << pen( dataset );
01060     
01061     return ret;
01062 }

DataValueAttributes AbstractDiagram::dataValueAttributes ( const QModelIndex &  index  )  const [inherited]

Retrieve the DataValueAttributes for the given index.

This will fall back automatically to what was set at dataset or model level, if there are no datapoint specific settings.

Parameters:
index The datapoint to retrieve the attributes for. With a dataset dimension of two, this is the index of the key of each key/value pair.
Returns:
The DataValueAttributes for the given index.

Definition at line 491 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DataValueLabelAttributesRole.

00492 {
00493     return qVariantValue<DataValueAttributes>(
00494         attributesModel()->data(
00495             conditionallyMapFromSource( index ),
00496             KDChart::DataValueLabelAttributesRole ) );
00497 }

DataValueAttributes AbstractDiagram::dataValueAttributes ( int  dataset  )  const [inherited]

Retrieve the DataValueAttributes for the given dataset.

This will fall back automatically to what was set at model level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.

Definition at line 465 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::dataValueAttributes(), and KDChart::DataValueLabelAttributesRole.

00466 {
00467     /*
00468     The following did not work!
00469     (khz, 2008-01-25)
00470     If there was some attrs specified for the 0-th cells of a dataset,
00471     then this logic would return the cell's settings instead of the header settings:
00472 
00473     return qVariantValue<DataValueAttributes>(
00474         attributesModel()->data( attributesModel()->mapFromSource(columnToIndex( column )),
00475         KDChart::DataValueLabelAttributesRole ) );
00476     */
00477     
00478     // To store the attributes for a dataset, we use the first column
00479     // that's associated with it. (i.e., with a dataset dimension
00480     // of two, the column of the keys)
00481     const int column = dataset * datasetDimension();
00482 
00483     const QVariant headerAttrs(
00484             attributesModel()->headerData( column, Qt::Vertical,
00485                 KDChart::DataValueLabelAttributesRole ) );
00486     if( headerAttrs.isValid() )
00487         return qVariantValue< DataValueAttributes >( headerAttrs );
00488     return dataValueAttributes();
00489 }

DataValueAttributes AbstractDiagram::dataValueAttributes (  )  const [inherited]

Retrieve the DataValueAttributes specified globally.

This will fall back automatically to the default settings, if there are no specific settings.

Returns:
The global DataValueAttributes.

Definition at line 459 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DataValueLabelAttributesRole, and KDChart::AttributesModel::modelData().

Referenced by KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::AbstractDiagram::paintMarker(), and KDChart::TernaryLineDiagram::TernaryLineDiagram().

00460 {
00461     return qVariantValue<DataValueAttributes>(
00462         attributesModel()->modelData( KDChart::DataValueLabelAttributesRole ) );
00463 }

void AbstractDiagram::doItemsLayout (  )  [virtual, inherited]

[reimplemented]

Definition at line 357 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::update().

00358 {
00359     if ( d->plane ) {
00360         d->plane->layoutDiagrams();
00361         update();
00362     }
00363     QAbstractItemView::doItemsLayout();
00364 }

qreal AbstractPieDiagram::granularity (  )  const [inherited]

Returns:
the granularity.

Definition at line 92 of file KDChartAbstractPieDiagram.cpp.

References d.

Referenced by KDChart::AbstractPieDiagram::compare(), KDChart::RingDiagram::paint(), and paintInternal().

00093 {
00094     return (d->granularity < 0.05 || d->granularity > 36.0)
00095             ? 1.0
00096     : d->granularity;
00097 }

int AbstractDiagram::horizontalOffset (  )  const [virtual, inherited]

[reimplemented]

Definition at line 958 of file KDChartAbstractDiagram.cpp.

00959 { return 0; }

QModelIndex AbstractDiagram::indexAt ( const QPoint &  point  )  const [virtual, inherited]

[reimplemented]

Definition at line 1123 of file KDChartAbstractDiagram.cpp.

References d.

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

01124 {
01125     return d->indexAt( point );
01126 }

QModelIndexList AbstractDiagram::indexesAt ( const QPoint &  point  )  const [inherited]

This method is added alongside with indexAt from QAIM, since in kdchart multiple indexes can be displayed at the same spot.

Definition at line 1128 of file KDChartAbstractDiagram.cpp.

References d.

01129 {
01130     return d->indexesAt( point );
01131 }

bool AbstractDiagram::isHidden ( const QModelIndex &  index  )  const [inherited]

Retrieve the hidden status for the given index.

This will fall back automatically to what was set at dataset or diagram level, if there are no datapoint specific settings.

Parameters:
index The datapoint to retrieve the hidden status for.
Returns:
The hidden status for the given index.

Definition at line 427 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DataHiddenRole.

00428 {
00429     return qVariantValue<bool>(
00430         attributesModel()->data(
00431             conditionallyMapFromSource(index),
00432             DataHiddenRole ) );
00433 }

bool AbstractDiagram::isHidden ( int  dataset  )  const [inherited]

Retrieve the hidden status for the given dataset.

This will fall back automatically to what was set at diagram level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the hidden status for.
Returns:
The hidden status for the given dataset.

Definition at line 413 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DataHiddenRole, KDChart::AbstractDiagram::datasetDimension(), and KDChart::AbstractDiagram::isHidden().

00414 {
00415     // To store the flag for a dataset, we use the first column
00416     // that's associated with it. (i.e., with a dataset dimension
00417     // of two, the column of the keys)
00418     const int column = dataset * datasetDimension();
00419     const QVariant boolFlag(
00420             attributesModel()->headerData( column, Qt::Vertical,
00421                     DataHiddenRole ) );
00422     if( boolFlag.isValid() )
00423         return qVariantValue< bool >( boolFlag );
00424     return isHidden();
00425 }

bool AbstractDiagram::isHidden (  )  const [inherited]

Retrieve the hidden status specified globally.

This will fall back automatically to the default settings ( = not hidden), if there are no specific settings.

Returns:
The global hidden status.

Definition at line 407 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DataHiddenRole, and KDChart::AttributesModel::modelData().

Referenced by KDChart::AbstractDiagram::isHidden(), and KDChart::LineDiagram::valueForCellTesting().

00408 {
00409     return qVariantValue<bool>(
00410         attributesModel()->modelData( DataHiddenRole ) );
00411 }

bool AbstractDiagram::isIndexHidden ( const QModelIndex &  index  )  const [virtual, inherited]

[reimplemented]

Definition at line 964 of file KDChartAbstractDiagram.cpp.

00965 { return true; }

QStringList AbstractDiagram::itemRowLabels (  )  const [inherited]

The set of item row labels currently displayed, for use in Abscissa axes, etc.

Returns:
The set of item row labels currently displayed.

Definition at line 1009 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AttributesModel::headerData(), KDChart::AttributesModel::rowCount(), KDChart::AbstractDiagram::unitPrefix(), and KDChart::AbstractDiagram::unitSuffix().

01010 {
01011     QStringList ret;
01012     if( model() ){
01013         //qDebug() << "AbstractDiagram::itemRowLabels(): " << attributesModel()->rowCount(attributesModelRootIndex()) << "entries";
01014         const int rowCount = attributesModel()->rowCount(attributesModelRootIndex());
01015         for( int i = 0; i < rowCount; ++i ){
01016             //qDebug() << "item row label: " << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString();
01017             ret << unitPrefix( i, Qt::Horizontal, true ) +
01018                    attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString() +
01019                    unitSuffix( i, Qt::Horizontal, true );
01020         }
01021     }
01022     return ret;
01023 }

void KDChart::AbstractDiagram::layoutChanged ( AbstractDiagram  )  [signal, inherited]

Diagrams are supposed to emit this signal, when the layout of one of their element changes.

Layouts can change, for example, when axes are added or removed, or when the configuration was changed in a way that the axes or the diagram itself are displayed in a different geometry. Changes in the diagrams coordinate system also result in the layoutChanged() signal being emitted.

Referenced by KDChart::AbstractDiagram::setDatasetDimensionInternal(), KDChart::LeveyJenningsDiagram::setModel(), KDChart::AbstractDiagram::setModel(), KDChart::BarDiagram::setOrientation(), KDChart::AbstractPieDiagram::setPieAttributes(), KDChart::AbstractPieDiagram::setThreeDPieAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().

void KDChart::AbstractDiagram::modelsChanged (  )  [signal, inherited]

This signal is emitted, when either the model or the AttributesModel is replaced.

Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::setSelectionModel().

QModelIndex AbstractDiagram::moveCursor ( CursorAction  cursorAction,
Qt::KeyboardModifiers  modifiers 
) [virtual, inherited]

[reimplemented]

Definition at line 955 of file KDChartAbstractDiagram.cpp.

00956 { return QModelIndex(); }

virtual double KDChart::AbstractPolarDiagram::numberOfDatasets (  )  const [virtual, inherited]

Reimplemented in KDChart::RingDiagram.

Definition at line 52 of file KDChartAbstractPolarDiagram.h.

Referenced by KDChart::AbstractPolarDiagram::rowCount().

00052 { return 1; };

double PieDiagram::numberOfGridRings (  )  const [virtual]

[reimplemented]

Implements KDChart::AbstractPolarDiagram.

Definition at line 1079 of file KDChartPieDiagram.cpp.

01080 {
01081     return 1;
01082 }

double PieDiagram::numberOfValuesPerDataset (  )  const [virtual]

[reimplemented]

Implements KDChart::AbstractPolarDiagram.

Definition at line 1073 of file KDChartPieDiagram.cpp.

01074 {
01075     return model() ? model()->columnCount( rootIndex() ) : 0.0;
01076 }

void PieDiagram::paint ( PaintContext paintContext  )  [protected, virtual]

[reimplemented]

Implements KDChart::AbstractDiagram.

Definition at line 174 of file KDChartPieDiagram.cpp.

References KDChart::PaintContext::painter(), paintInternal(), KDChart::PaintContext::rectangle(), and KDChart::PaintContext::setPainter().

Referenced by paintEvent().

00175 {
00176     // Painting is a two stage process
00177     // In the first stage we figure out how much space is needed
00178     // for text labels.
00179     // In the second stage, we make use of that information and
00180     // perform the actual painting.
00181     QPainter* actualPainter = ctx->painter();
00182     QRectF textBoundingRect;
00183 
00184     // Use a null paint device and perform the first painting.
00185     KDChart::NullPaintDevice nullPd(ctx->rectangle().size().toSize());
00186     QPainter nullPainter(&nullPd);
00187     ctx->setPainter(&nullPainter);
00188     paintInternal(ctx, textBoundingRect);
00189 
00190     // Now perform the real painting
00191     ctx->setPainter(actualPainter);
00192     paintInternal(ctx, textBoundingRect);
00193 }

void AbstractDiagram::paintDataValueText ( QPainter *  painter,
const QModelIndex &  index,
const QPointF &  pos,
double  value 
) [inherited]

Definition at line 539 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::paintDataValueTexts().

00543 {
00544     d->paintDataValueText( this, painter, index, pos, value );
00545 }

void AbstractDiagram::paintDataValueTexts ( QPainter *  painter  )  [protected, virtual, inherited]

This method is obsolete and provided for backward-compatibility only.

Your own diagram classes should call d->paintDataValueTextsAndMarkers() instead which also is taking care for showing your cell-specific comments, if any,

Definition at line 555 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), d, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::paintDataValueText(), and KDChart::AbstractCoordinatePlane::translate().

00556 {
00557     if ( !checkInvariants() ) return;
00558     const int rowCount = model()->rowCount(rootIndex());
00559     const int columnCount = model()->columnCount(rootIndex());
00560     d->clearListOfAlreadyDrawnDataValueTexts();
00561     for ( int i=datasetDimension()-1; i<columnCount; i += datasetDimension() ) {
00562        for ( int j=0; j< rowCount; ++j ) {
00563            const QModelIndex index = model()->index( j, i, rootIndex() );
00564            double value = model()->data( index ).toDouble();
00565            const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
00566            paintDataValueText( painter, index, pos, value );
00567        }
00568     }
00569 }

void PieDiagram::paintEvent ( QPaintEvent *   )  [protected]

Definition at line 101 of file KDChartPieDiagram.cpp.

References paint(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().

00102 {
00103     QPainter painter ( viewport() );
00104     PaintContext ctx;
00105     ctx.setPainter ( &painter );
00106     ctx.setRectangle( QRectF ( 0, 0, width(), height() ) );
00107     paint ( &ctx );
00108 }

void PieDiagram::paintInternal ( PaintContext paintContext,
QRectF &  textBoundingRect 
) [protected]

Definition at line 195 of file KDChartPieDiagram.cpp.

References buildReferenceRect(), KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractPolarDiagram::columnCount(), d, KDChart::AbstractThreeDAttributes::depth(), KDChart::PieAttributes::explodeFactor(), KDChart::AbstractPieDiagram::granularity(), KDChart::AbstractThreeDAttributes::isEnabled(), KDChart::PaintContext::painter(), KDChart::AbstractPieDiagram::pieAttributes(), KDChart::AbstractPolarDiagram::polarCoordinatePlane(), KDChart::PaintContext::rectangle(), KDChart::PolarCoordinatePlane::startPosition(), KDChart::AbstractPieDiagram::threeDPieAttributes(), and valueTotals().

Referenced by paint().

00196 {
00197     // note: Not having any data model assigned is no bug
00198     //       but we can not draw a diagram then either.
00199     if ( !checkInvariants(true) )
00200         return;
00201 
00202     d->reverseMapper.clear();
00203 
00204     const PieAttributes attrs( pieAttributes() );
00205     const ThreeDPieAttributes threeDAttrs( threeDPieAttributes( model()->index( 0, 0, rootIndex() ) ) );
00206 
00207     const int colCount = columnCount();
00208 
00209     QRectF contentsRect( buildReferenceRect( polarCoordinatePlane() ) );
00210     contentsRect = ctx->rectangle();
00211 //    contentsRect = geometry();
00212 //qDebug() << contentsRect;
00213     if( contentsRect.isEmpty() )
00214         return;
00215 
00216     DataValueTextInfoList list;
00217     const qreal sum = valueTotals();
00218 
00219     if( sum == 0.0 ) //nothing to draw
00220         return;
00221 
00222     d->startAngles.resize( colCount );
00223     d->angleLens.resize( colCount );
00224 
00225     // compute position
00226     d->size = qMin( contentsRect.width(), contentsRect.height() ); // initial size
00227 
00228     // if the pies explode, we need to give them additional space =>
00229     // make the basic size smaller
00230     qreal maxExplode = 0.0;
00231     for( int j = 0; j < colCount; ++j ){
00232         const PieAttributes columnAttrs( pieAttributes( model()->index( 0, j, rootIndex() ) ) );
00233         maxExplode = qMax( maxExplode, columnAttrs.explodeFactor() );
00234     }
00235     d->size /= ( 1.0 + 2.0 * maxExplode );
00236 
00237     if(!textBoundingRect.isEmpty())
00238     {
00239         // Find out the maximum distance from every corner of the rectangle with
00240         // the center.
00241         double maxDistance = 0, dist = 0;
00242 
00243         QPointF center = ctx->rectangle().center();
00244 
00245         dist = qAbs(textBoundingRect.right() - center.x());
00246         if(dist > maxDistance)
00247             maxDistance = dist;
00248 
00249         dist = qAbs(textBoundingRect.left() - center.x());
00250         if(dist > maxDistance)
00251             maxDistance = dist;
00252 
00253         dist = qAbs(textBoundingRect.top() - center.y());
00254         if(dist > maxDistance)
00255             maxDistance = dist;
00256 
00257         dist = qAbs(textBoundingRect.bottom() - center.y());
00258         if(dist > maxDistance)
00259             maxDistance = dist;
00260 
00261         double size = d->size;
00262         double diff = (2*maxDistance - d->size);
00263         if(diff > 0)
00264             d->size *= 1.0-(diff/size);
00265     }
00266 
00267     qreal sizeFor3DEffect = 0.0;
00268     if ( ! threeDAttrs.isEnabled() ) {
00269 
00270         qreal x = ( contentsRect.width() == d->size ) ? 0.0 : ( ( contentsRect.width() - d->size ) / 2.0 );
00271         qreal y = ( contentsRect.height() == d->size ) ? 0.0 : ( ( contentsRect.height() - d->size ) / 2.0 );
00272         d->position = QRectF( x, y, d->size, d->size );
00273         d->position.translate( contentsRect.left(), contentsRect.top() );
00274     } else {
00275         // threeD: width is the maximum possible width; height is 1/2 of that
00276         qreal x = ( contentsRect.width() == d->size ) ? 0.0 : ( ( contentsRect.width() - d->size ) / 2.0 );
00277         qreal height = d->size;
00278         // make sure that the height plus the threeDheight is not more than the
00279         // available size
00280         if ( threeDAttrs.depth() >= 0.0 ) {
00281             // positive pie height: absolute value
00282             sizeFor3DEffect = threeDAttrs.depth();
00283             height = d->size - sizeFor3DEffect;
00284         } else {
00285             // negative pie height: relative value
00286             sizeFor3DEffect = - threeDAttrs.depth() / 100.0 * height;
00287             height = d->size - sizeFor3DEffect;
00288         }
00289         qreal y = ( contentsRect.height() == height ) ? 0.0 : ( ( contentsRect.height() - height - sizeFor3DEffect ) / 2.0 );
00290 
00291         d->position = QRectF( contentsRect.left() + x, contentsRect.top() + y,
00292                 d->size, height );
00293         //  d->position.moveBy( contentsRect.left(), contentsRect.top() );
00294     }
00295 
00296     const PolarCoordinatePlane * plane = polarCoordinatePlane();
00297     const qreal sectorsPerValue = 360.0 / sum;
00298     qreal currentValue = plane ? plane->startPosition() : 0.0;
00299 
00300     bool atLeastOneValue = false; // guard against completely empty tables
00301     QVariant vValY;
00302     for ( int iColumn = 0; iColumn < colCount; ++iColumn ) {
00303         // is there anything at all at this column?
00304         bool bOK;
00305         const double cellValue = qAbs( model()->data( model()->index( 0, iColumn, rootIndex() ) )
00306             .toDouble( &bOK ) );
00307 
00308         if( bOK ){
00309             d->startAngles[ iColumn ] = currentValue;
00310             d->angleLens[ iColumn ] = cellValue * sectorsPerValue;
00311             atLeastOneValue = true;
00312         } else { // mark as non-existent
00313             d->angleLens[ iColumn ] = 0.0;
00314             if ( iColumn > 0.0 )
00315                 d->startAngles[ iColumn ] = d->startAngles[ iColumn - 1 ];
00316             else
00317                 d->startAngles[ iColumn ] = currentValue;
00318         }
00319         //qDebug() << "d->startAngles["<<iColumn<<"] == " << d->startAngles[ iColumn ]
00320         //         << " +  d->angleLens["<<iColumn<<"]" << d->angleLens[ iColumn ]
00321         //         << " = " << d->startAngles[ iColumn ]+d->angleLens[ iColumn ];
00322 
00323         currentValue = d->startAngles[ iColumn ] + d->angleLens[ iColumn ];
00324     }
00325 
00326     // If there was no value at all, bail out, to avoid endless loops
00327     // later on (e.g. in findPieAt()).
00328     if( ! atLeastOneValue )
00329         return;
00330 
00331 
00332     // Find the backmost pie which is at +90° and needs to be drawn
00333     // first
00334     int backmostpie = findPieAt( 90, colCount );
00335     // Find the frontmost pie (at -90°/+270°) that should be drawn last
00336     int frontmostpie = findPieAt( 270, colCount );
00337     // the right- and the leftmost (only needed in some special cases...)
00338     int rightmostpie = findPieAt( 0, colCount );
00339     int leftmostpie = findPieAt( 180, colCount );
00340 
00341 
00342     int currentLeftPie = backmostpie;
00343     int currentRightPie = backmostpie;
00344 
00345     d->clearListOfAlreadyDrawnDataValueTexts();
00346 
00347     drawOnePie( ctx->painter(), &list, 0, backmostpie, granularity(), sizeFor3DEffect );
00348 
00349     if( backmostpie == frontmostpie )
00350     {
00351         if( backmostpie == leftmostpie )
00352             currentLeftPie = findLeftPie( currentLeftPie, colCount );
00353         if( backmostpie == rightmostpie )
00354             currentRightPie = findRightPie( currentRightPie, colCount );
00355     }
00356     while( currentLeftPie != frontmostpie )
00357     {
00358         if( currentLeftPie != backmostpie )
00359             drawOnePie( ctx->painter(), &list, 0, currentLeftPie, granularity(), sizeFor3DEffect );
00360         currentLeftPie = findLeftPie( currentLeftPie, colCount );
00361     }
00362     while( currentRightPie != frontmostpie )
00363     {
00364         if( currentRightPie != backmostpie )
00365             drawOnePie( ctx->painter(), &list, 0, currentRightPie, granularity(), sizeFor3DEffect );
00366         currentRightPie = findRightPie( currentRightPie, colCount );
00367     }
00368 
00369     // if the backmost pie is not the frontmost pie, we draw the frontmost at last
00370     if( backmostpie != frontmostpie || ! threeDPieAttributes().isEnabled() )
00371     {
00372         drawOnePie( ctx->painter(), &list, 0, frontmostpie, granularity(), sizeFor3DEffect );
00373     // otherwise, this gets a bit more complicated...
00374 /*    } else if( threeDPieAttributes().isEnabled() ) {
00375         //drawPieSurface( ctx->painter(), 0, frontmostpie, granularity() );
00376         const QModelIndex index = model()->index( 0, frontmostpie, rootIndex() );
00377         QPen pen = this->pen( index );
00378         ctx->painter()->setBrush( brush( index ) );
00379         if ( threeDAttrs.isEnabled() )
00380             pen.setColor( QColor( 0, 0, 0 ) );
00381         ctx->painter()->setPen( pen );
00382 
00383         qreal startAngle = d->startAngles[ frontmostpie ];
00384         if( startAngle > 360 )
00385             startAngle -= 360;
00386 
00387         qreal endAngle = startAngle + d->angleLens[ frontmostpie ];
00388         startAngle = qMax( startAngle, 180.0 );
00389 
00390         drawArcEffectSegment( ctx->painter(), piePosition( 0, frontmostpie),
00391                 sizeFor3DEffect, startAngle, endAngle, granularity() );*/
00392     }
00393 
00394     d->paintDataValueTextsAndMarkers(  this,  ctx,  list,  false, false, &textBoundingRect );
00395 }

void AbstractDiagram::paintMarker ( QPainter *  painter,
const QModelIndex &  index,
const QPointF &  pos 
) [inherited]

Definition at line 600 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::dataValueAttributes(), and KDChart::AbstractDiagram::paintMarker().

00603 {
00604     if ( !checkInvariants() ) return;
00605     paintMarker( painter, dataValueAttributes( index ), index, pos );
00606 }

void AbstractDiagram::paintMarker ( QPainter *  painter,
const DataValueAttributes a,
const QModelIndex &  index,
const QPointF &  pos 
) [inherited]

Definition at line 572 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::checkInvariants(), d, KDChart::MarkerAttributes::isVisible(), KDChart::DataValueAttributes::isVisible(), KDChart::DataValueAttributes::markerAttributes(), KDChart::MarkerAttributes::markerColor(), KDChart::MarkerAttributes::markerSize(), KDChart::AbstractDiagram::paintMarker(), and KDChart::MarkerAttributes::pen().

00576 {
00577     if ( !checkInvariants() || !a.isVisible() ) return;
00578     const MarkerAttributes ma = a.markerAttributes();
00579     if ( !ma.isVisible() ) return;
00580 
00581     const PainterSaver painterSaver( painter );
00582     // the size of the marker - unscaled
00583     const QSizeF maSize( ma.markerSize().width() / painter->matrix().m11(), 
00584                          ma.markerSize().height() / painter->matrix().m22() );
00585     QBrush indexBrush( brush( index ) );
00586     QPen indexPen( ma.pen() );
00587     if ( ma.markerColor().isValid() )
00588         indexBrush.setColor( ma.markerColor() );
00589 
00590     paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
00591 
00592     // workaround: BC cannot be changed, otherwise we would pass the
00593     // index down to next-lower paintMarker function. So far, we
00594     // basically save a circle of radius maSize at pos in the
00595     // reverseMapper. This means that ^^^ this version of paintMarker
00596     // needs to be called to reverse-map the marker.
00597     d->reverseMapper.addCircle( index.row(), index.column(), pos, 2 * maSize );
00598 }

void AbstractDiagram::paintMarker ( QPainter *  painter,
const MarkerAttributes markerAttributes,
const QBrush &  brush,
const QPen &  pen,
const QPointF &  point,
const QSizeF &  size 
) [virtual, inherited]

Definition at line 608 of file KDChartAbstractDiagram.cpp.

References KDChart::MarkerAttributes::Marker1Pixel, KDChart::MarkerAttributes::Marker4Pixels, KDChart::MarkerAttributes::MarkerCircle, KDChart::MarkerAttributes::MarkerCross, KDChart::MarkerAttributes::MarkerDiamond, KDChart::MarkerAttributes::MarkerFastCross, KDChart::MarkerAttributes::MarkerRing, KDChart::MarkerAttributes::MarkerSquare, KDChart::MarkerAttributes::markerStyle(), p, and KDChart::PrintingParameters::scalePen().

Referenced by KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::MarkerLayoutItem::paintIntoRect(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractDiagram::paintMarkers().

00614 {
00615     const QPen oldPen( painter->pen() );
00616     // Pen is used to paint 4Pixels - 1 Pixel - Ring and FastCross types.
00617     // make sure to use the brush color - see above in those cases.
00618     const bool isFourPixels = (markerAttributes.markerStyle() == MarkerAttributes::Marker4Pixels);
00619     if( isFourPixels || (markerAttributes.markerStyle() == MarkerAttributes::Marker1Pixel) ){
00620         // for high-performance point charts with tiny point markers:
00621         painter->setPen( PrintingParameters::scalePen( QPen( brush.color().light() ) ) );
00622         if( isFourPixels ){
00623             const qreal x = pos.x();
00624             const qreal y = pos.y();
00625             painter->drawLine( QPointF(x-1.0,y-1.0),
00626                                QPointF(x+1.0,y-1.0) );
00627             painter->drawLine( QPointF(x-1.0,y),
00628                                QPointF(x+1.0,y) );
00629             painter->drawLine( QPointF(x-1.0,y+1.0),
00630                                QPointF(x+1.0,y+1.0) );
00631         }
00632         painter->drawPoint( pos );
00633     }else{
00634         const PainterSaver painterSaver( painter );
00635         // we only a solid line surrounding the markers
00636         QPen painterPen( pen );
00637         painterPen.setStyle( Qt::SolidLine );
00638         painter->setPen( PrintingParameters::scalePen( painterPen ) );
00639         painter->setBrush( brush );
00640         painter->setRenderHint ( QPainter::Antialiasing );
00641         painter->translate( pos );
00642         switch ( markerAttributes.markerStyle() ) {
00643             case MarkerAttributes::MarkerCircle:
00644                 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
00645                             maSize.height(), maSize.width()) );
00646                 break;
00647             case MarkerAttributes::MarkerSquare:
00648                 {
00649                     QRectF rect( 0 - maSize.width()/2, 0 - maSize.height()/2,
00650                                 maSize.width(), maSize.height() );
00651                     painter->drawRect( rect );
00652                     break;
00653                 }
00654             case MarkerAttributes::MarkerDiamond:
00655                 {
00656                     QVector <QPointF > diamondPoints;
00657                     QPointF top, left, bottom, right;
00658                     top    = QPointF( 0, 0 - maSize.height()/2 );
00659                     left   = QPointF( 0 - maSize.width()/2, 0 );
00660                     bottom = QPointF( 0, maSize.height()/2 );
00661                     right  = QPointF( maSize.width()/2, 0 );
00662                     diamondPoints << top << left << bottom << right;
00663                     painter->drawPolygon( diamondPoints );
00664                     break;
00665                 }
00666             // both handled on top of the method:
00667             case MarkerAttributes::Marker1Pixel:
00668             case MarkerAttributes::Marker4Pixels:
00669                     break;
00670             case MarkerAttributes::MarkerRing:
00671                 {
00672                     painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
00673                     painter->setBrush( Qt::NoBrush );
00674                     painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
00675                                         maSize.height(), maSize.width()) );
00676                     break;
00677                 }
00678             case MarkerAttributes::MarkerCross:
00679                 {
00680                     // Note: Markers can have outline,
00681                     //       so just drawing two rects is NOT the solution here!
00682                     const qreal w02 = maSize.width() * 0.2;
00683                     const qreal w05 = maSize.width() * 0.5;
00684                     const qreal h02 = maSize.height()* 0.2;
00685                     const qreal h05 = maSize.height()* 0.5;
00686                     QVector <QPointF > crossPoints;
00687                     QPointF p[12];
00688                     p[ 0] = QPointF( -w02, -h05 );
00689                     p[ 1] = QPointF(  w02, -h05 );
00690                     p[ 2] = QPointF(  w02, -h02 );
00691                     p[ 3] = QPointF(  w05, -h02 );
00692                     p[ 4] = QPointF(  w05,  h02 );
00693                     p[ 5] = QPointF(  w02,  h02 );
00694                     p[ 6] = QPointF(  w02,  h05 );
00695                     p[ 7] = QPointF( -w02,  h05 );
00696                     p[ 8] = QPointF( -w02,  h02 );
00697                     p[ 9] = QPointF( -w05,  h02 );
00698                     p[10] = QPointF( -w05, -h02 );
00699                     p[11] = QPointF( -w02, -h02 );
00700                     for( int i=0; i<12; ++i )
00701                         crossPoints << p[i];
00702                     crossPoints << p[0];
00703                     painter->drawPolygon( crossPoints );
00704                     break;
00705                 }
00706             case MarkerAttributes::MarkerFastCross:
00707                 {
00708                     QPointF left, right, top, bottom;
00709                     left  = QPointF( -maSize.width()/2, 0 );
00710                     right = QPointF( maSize.width()/2, 0 );
00711                     top   = QPointF( 0, -maSize.height()/2 );
00712                     bottom= QPointF( 0, maSize.height()/2 );
00713                     painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
00714                     painter->drawLine( left, right );
00715                     painter->drawLine(  top, bottom );
00716                     break;
00717                 }
00718             default:
00719                 Q_ASSERT_X ( false, "paintMarkers()",
00720                             "Type item does not match a defined Marker Type." );
00721         }
00722     }
00723     painter->setPen( oldPen );
00724 }

void AbstractDiagram::paintMarkers ( QPainter *  painter  )  [protected, virtual, inherited]

This method is obsolete and provided for backward-compatibility only.

Your own diagram classes should call d->paintDataValueTextsAndMarkers() instead which also is taking care for showing your cell-specific comments, if any,

Definition at line 726 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractDiagram::coordinatePlane(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::paintMarker(), and KDChart::AbstractCoordinatePlane::translate().

00727 {
00728     if ( !checkInvariants() ) return;
00729     const int rowCount = model()->rowCount(rootIndex());
00730     const int columnCount = model()->columnCount(rootIndex());
00731     for ( int i=datasetDimension()-1; i<columnCount; i += datasetDimension() ) {
00732        for ( int j=0; j< rowCount; ++j ) {
00733            const QModelIndex index = model()->index( j, i, rootIndex() );
00734            double value = model()->data( index ).toDouble();
00735            const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
00736            paintMarker( painter, index, pos );
00737        }
00738     }
00739 }

QPen AbstractDiagram::pen ( const QModelIndex &  index  )  const [inherited]

Retrieve the pen to be used, for painting the datapoint at the given index in the model.

Parameters:
index The index of the datapoint in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
Returns:
The pen to use for painting.

Definition at line 792 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetPenRole.

00793 {
00794     return qVariantValue<QPen>(
00795         attributesModel()->data(
00796             conditionallyMapFromSource( index ),
00797             DatasetPenRole ) );
00798 }

QPen AbstractDiagram::pen ( int  dataset  )  const [inherited]

Retrieve the pen to be used for the given dataset.

This will fall back automatically to what was set at model level, if there are no dataset specific settings.

Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.

Definition at line 777 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, and KDChart::AbstractDiagram::pen().

00778 {
00779     // To store the pen for a dataset, we use the first column
00780     // that's associated with it. (i.e., with a dataset dimension
00781     // of two, the column of the keys)
00782     const int column = dataset * datasetDimension();
00783     
00784     const QVariant penSettings(
00785             attributesModel()->headerData( column, Qt::Vertical,
00786                     DatasetPenRole ) );
00787     if( penSettings.isValid() )
00788         return qVariantValue< QPen >( penSettings );
00789     return pen();
00790 }

QPen AbstractDiagram::pen (  )  const [inherited]

Retrieve the pen to be used for painting datapoints globally.

This will fall back automatically to the default settings, if there are no specific settings.

Returns:
The pen to use for painting.

Definition at line 771 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AttributesModel::data(), and KDChart::DatasetPenRole.

Referenced by KDChart::AbstractDiagram::datasetPens(), KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), and KDChart::AbstractDiagram::pen().

00772 {
00773     return qVariantValue<QPen>(
00774         attributesModel()->data( DatasetPenRole ) );
00775 }

bool AbstractDiagram::percentMode (  )  const [inherited]

Definition at line 533 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::compare().

00534 {
00535     return d->percent;
00536 }

PieAttributes AbstractPieDiagram::pieAttributes ( const QModelIndex &  index  )  const [inherited]

Definition at line 153 of file KDChartAbstractPieDiagram.cpp.

References d, and KDChart::PieAttributesRole.

00154 {
00155     return qVariantValue<PieAttributes>(
00156         d->attributesModel->data(
00157             d->attributesModel->mapFromSource( index ),
00158             PieAttributesRole ) );
00159 }

PieAttributes AbstractPieDiagram::pieAttributes ( int  column  )  const [inherited]

Definition at line 143 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractPieDiagram::pieAttributes(), and KDChart::PieAttributesRole.

00144 {
00145     const QVariant attrs(
00146             d->attributesModel->headerData( column, Qt::Vertical,
00147                                             PieAttributesRole ) );
00148     if( attrs.isValid() )
00149         return qVariantValue< PieAttributes >( attrs );
00150     return pieAttributes();
00151 }

PieAttributes AbstractPieDiagram::pieAttributes (  )  const [inherited]

Definition at line 134 of file KDChartAbstractPieDiagram.cpp.

References d, and KDChart::PieAttributesRole.

Referenced by KDChart::RingDiagram::calculateDataBoundaries(), calculateDataBoundaries(), KDChart::RingDiagram::paint(), paintInternal(), and KDChart::AbstractPieDiagram::pieAttributes().

00135 {
00136     return qVariantValue<PieAttributes>(
00137         d->attributesModel->data( PieAttributesRole ) );
00138 }

const PolarCoordinatePlane * AbstractPolarDiagram::polarCoordinatePlane (  )  const [inherited]

Definition at line 55 of file KDChartAbstractPolarDiagram.cpp.

References KDChart::AbstractDiagram::coordinatePlane().

Referenced by KDChart::RingDiagram::paint(), and paintInternal().

00056 {
00057     return dynamic_cast<const PolarCoordinatePlane*>( coordinatePlane() );
00058 }

void KDChart::AbstractDiagram::propertiesChanged (  )  [signal, inherited]

Emitted upon change of a property of the Diagram.

Referenced by KDChart::Plotter::resetLineAttributes(), KDChart::LineDiagram::resetLineAttributes(), KDChart::AbstractDiagram::setAllowOverlappingDataValueTexts(), KDChart::AbstractDiagram::setAntiAliasing(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), KDChart::LineDiagram::setCenterDataPoints(), KDChart::AbstractDiagram::setDataValueAttributes(), KDChart::Plotter::setLineAttributes(), KDChart::LineDiagram::setLineAttributes(), KDChart::BarDiagram::setOrientation(), KDChart::AbstractDiagram::setPen(), KDChart::AbstractDiagram::setPercentMode(), StockDiagram::setStockBarAttributes(), StockDiagram::setThreeDBarAttributes(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Plotter::setThreeDLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), StockDiagram::setType(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), KDChart::BarDiagram::setType(), KDChart::Plotter::setValueTrackerAttributes(), and KDChart::LineDiagram::setValueTrackerAttributes().

void PieDiagram::resize ( const QSizeF &  area  )  [virtual]

[reimplemented]

Implements KDChart::AbstractDiagram.

Definition at line 114 of file KDChartPieDiagram.cpp.

00115 {
00116 }

void PieDiagram::resizeEvent ( QResizeEvent *   )  [protected]

Definition at line 110 of file KDChartPieDiagram.cpp.

00111 {
00112 }

int AbstractPolarDiagram::rowCount (  )  const [inherited]

Definition at line 65 of file KDChartAbstractPolarDiagram.cpp.

References KDChart::AbstractPolarDiagram::numberOfDatasets().

Referenced by KDChart::RingDiagram::calculateDataBoundaries(), KDChart::PolarDiagram::calculateDataBoundaries(), KDChart::RingDiagram::paint(), KDChart::PolarDiagram::paint(), and KDChart::RingDiagram::valueTotals().

00066 {
00067     return static_cast<int>( numberOfDatasets() );
00068 }

void AbstractDiagram::scrollTo ( const QModelIndex &  index,
ScrollHint  hint = EnsureVisible 
) [virtual, inherited]

[reimplemented]

Definition at line 950 of file KDChartAbstractDiagram.cpp.

00951 {}

void AbstractDiagram::setAllowOverlappingDataValueTexts ( bool  allow  )  [inherited]

Set whether data value labels are allowed to overlap.

Parameters:
allow True means that overlapping labels are allowed.

Definition at line 505 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::propertiesChanged().

00506 {
00507     d->allowOverlappingDataValueTexts = allow;
00508     emit propertiesChanged();
00509 }

void AbstractDiagram::setAntiAliasing ( bool  enabled  )  [inherited]

Set whether anti-aliasing is to be used while rendering this diagram.

Parameters:
enabled True means that AA is enabled.

Definition at line 516 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::propertiesChanged().

00517 {
00518     d->antiAliasing = enabled;
00519     emit propertiesChanged();
00520 }

void AbstractDiagram::setAttributesModel ( AttributesModel amodel  )  [virtual, inherited]

Associate an AttributesModel with this diagram.

Note that the diagram does _not_ take ownership of the AttributesModel. This should thus only be used with AttributesModels that have been explicitly created by the user, and are owned by her. Setting an AttributesModel that is internal to another diagram is an error.

Correct:

 AttributesModel *am = new AttributesModel( model, 0 );
 diagram1->setAttributesModel( am );
 diagram2->setAttributesModel( am );

Wrong:

 diagram1->setAttributesModel( diagram2->attributesModel() );

Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel, usesExternalAttributesModel
Sets an external AttributesModel on this diagram. By default, a diagram has it's own internal set of attributes, but an external one can be set. This can be used to share attributes between several diagrams. The diagram does not take ownership of the attributesmodel.

Reimplemented in KDChart::AbstractCartesianDiagram.

Definition at line 290 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::modelsChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().

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

00291 {
00292     if( amodel->sourceModel() != model() ) {
00293         qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
00294                  "Trying to set an attributesmodel which works on a different "
00295                  "model than the diagram.");
00296         return;
00297     }
00298     if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
00299         qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
00300                  "Trying to set an attributesmodel that is private to another diagram.");
00301         return;
00302     }
00303     d->setAttributesModel(amodel);
00304     scheduleDelayedItemsLayout();
00305     setDataBoundariesDirty();
00306     emit modelsChanged();
00307 }

void AbstractDiagram::setAttributesModelRootIndex ( const QModelIndex &  idx  )  [protected, inherited]

Definition at line 336 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::AbstractDiagram::setRootIndex().

00337 {
00338     d->attributesModelRootIndex=idx;
00339     setDataBoundariesDirty();
00340     scheduleDelayedItemsLayout();
00341 }

void AbstractDiagram::setBrush ( const QBrush &  brush  )  [inherited]

Set the brush to be used, for painting all datasets in the model.

Parameters:
brush The brush to use.

Definition at line 808 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setModelData().

00809 {
00810     attributesModel()->setModelData(
00811         qVariantFromValue( brush ), DatasetBrushRole );
00812     emit propertiesChanged();
00813 }

void AbstractDiagram::setBrush ( int  dataset,
const QBrush &  brush 
) [inherited]

Set the brush to be used, for painting the given dataset.

Parameters:
dataset The dataset to set the brush for.
brush The brush to use.

Definition at line 815 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setHeaderData().

00816 {
00817     // To store the brush for a dataset, we use the first column
00818     // that's associated with it. (i.e., with a dataset dimension
00819     // of two, the column of the keys)
00820     const int column = dataset * datasetDimension();
00821     
00822     attributesModel()->setHeaderData(
00823         column, Qt::Vertical,
00824         qVariantFromValue( brush ),
00825         DatasetBrushRole );
00826     emit propertiesChanged();
00827 }

void AbstractDiagram::setBrush ( const QModelIndex &  index,
const QBrush &  brush 
) [inherited]

Set the brush to be used, for painting the datapoint at the given index.

Parameters:
index The datapoint's index in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
brush The brush to use.

Definition at line 800 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetBrushRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setData().

00801 {
00802     attributesModel()->setData(
00803         conditionallyMapFromSource( index ),
00804         qVariantFromValue( brush ), DatasetBrushRole );
00805     emit propertiesChanged();
00806 }

void AbstractDiagram::setCoordinatePlane ( AbstractCoordinatePlane plane  )  [virtual, inherited]

Set the coordinate plane associated with the diagram.

This determines how coordinates in value space are mapped into pixel space. The chart takes ownership.

Returns:
The coordinate plane associated with the diagram.

Reimplemented in KDChart::AbstractCartesianDiagram.

Definition at line 352 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesianDiagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().

00353 {
00354     d->plane = parent;
00355 }

void AbstractDiagram::setDataBoundariesDirty (  )  const [protected, slot, inherited]

Definition at line 236 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::dataChanged(), StockDiagram::resize(), KDChart::Plotter::resize(), KDChart::LineDiagram::resize(), KDChart::BarDiagram::resize(), KDChart::AbstractDiagram::setAttributesModel(), KDChart::AbstractDiagram::setAttributesModelRootIndex(), KDChart::AbstractDiagram::setDatasetDimensionInternal(), KDChart::AbstractDiagram::setModel(), KDChart::BarDiagram::setOrientation(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Plotter::setThreeDLineAttributes(), KDChart::LineDiagram::setThreeDLineAttributes(), KDChart::Plotter::setType(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().

00237 {
00238     d->databoundariesDirty = true;
00239 }

void AbstractDiagram::setDatasetDimension ( int  dimension  )  [inherited]

Sets the dataset dimension of the diagram. Using this method is obsolete. Use the specific diagram types instead.

Definition at line 1094 of file KDChartAbstractDiagram.cpp.

01095 {
01096     Q_UNUSED( dimension );
01097     qDebug() << "Setting the dataset dimension using AbstractDiagram::setDatasetDimension is obsolete. Use the specific diagram types instead.";
01098 }

void AbstractDiagram::setDatasetDimensionInternal ( int  dimension  )  [protected, inherited]

Definition at line 1100 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::TernaryLineDiagram::TernaryLineDiagram(), and KDChart::TernaryPointDiagram::TernaryPointDiagram().

01101 {
01102     Q_ASSERT( dimension != 0 );
01103     
01104     if ( d->datasetDimension == dimension ) return;
01105     d->datasetDimension = dimension;
01106     setDataBoundariesDirty();
01107     emit layoutChanged( this );
01108 }

void AbstractDiagram::setDataValueAttributes ( const DataValueAttributes a  )  [inherited]

Set the DataValueAttributes for all datapoints in the model.

Parameters:
a The attributes to set.

Definition at line 499 of file KDChartAbstractDiagram.cpp.

References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().

00500 {
00501     d->attributesModel->setModelData( qVariantFromValue( a ), DataValueLabelAttributesRole );
00502     emit propertiesChanged();
00503 }

void AbstractDiagram::setDataValueAttributes ( int  dataset,
const DataValueAttributes a 
) [inherited]

Set the DataValueAttributes for the given dataset.

Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.

Definition at line 447 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::datasetDimension(), KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().

00448 {
00449     // To store the attributes for a dataset, we use the first column
00450     // that's associated with it. (i.e., with a dataset dimension
00451     // of two, the column of the keys)
00452     const int column = dataset * datasetDimension();
00453     d->attributesModel->setHeaderData(
00454         column, Qt::Vertical,
00455         qVariantFromValue( a ), DataValueLabelAttributesRole );
00456     emit propertiesChanged();
00457 }

void AbstractDiagram::setDataValueAttributes ( const QModelIndex &  index,
const DataValueAttributes a 
) [inherited]

Set the DataValueAttributes for the given index.

Parameters:
index The datapoint to set the attributes for. With a dataset dimension of two, this is the index of the key of each key/value pair.
a The attributes to set.

Definition at line 436 of file KDChartAbstractDiagram.cpp.

References d, KDChart::DataValueLabelAttributesRole, and KDChart::AbstractDiagram::propertiesChanged().

00438 {
00439     d->attributesModel->setData(
00440         conditionallyMapFromSource( index ),
00441         qVariantFromValue( a ),
00442         DataValueLabelAttributesRole );
00443     emit propertiesChanged();
00444 }

void AbstractPieDiagram::setGranularity ( qreal  value  )  [inherited]

Set the granularity: the smaller the granularity the more your diagram segments will show facettes instead of rounded segments.

Parameters:
value the granularity value between 0.05 (one twentieth of a degree) and 36.0 (one tenth of a full circle), other values will be interpreted as 1.0.

Definition at line 87 of file KDChartAbstractPieDiagram.cpp.

References d.

00088 {
00089     d->granularity = value;
00090 }

void AbstractDiagram::setHidden ( bool  hidden  )  [inherited]

Hide (or unhide, resp.

) all datapoints in the model.

Note:
Hidden data are still taken into account by the coordinate plane, so neither the grid nor your axes' ranges will change, when you hide data. For totally removing data from KD Chart's view you can use another approach: e.g. you could define a proxy model on top of your data model, and register the proxy model calling setModel() instead of registering your real data model.
Parameters:
hidden The hidden status to set.

Definition at line 399 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.

00400 {
00401     d->attributesModel->setModelData(
00402         qVariantFromValue( hidden ),
00403         DataHiddenRole );
00404     emit dataHidden();
00405 }

void AbstractDiagram::setHidden ( int  dataset,
bool  hidden 
) [inherited]

Hide (or unhide, resp.

) a dataset.

Note:
Hidden data are still taken into account by the coordinate plane, so neither the grid nor your axes' ranges will change, when you hide data. For totally removing data from KD Chart's view you can use another approach: e.g. you could define a proxy model on top of your data model, and register the proxy model calling setModel() instead of registering your real data model.
Parameters:
dataset The dataset to set the hidden status for.
hidden The hidden status to set.

Definition at line 386 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::dataHidden(), KDChart::DataHiddenRole, and KDChart::AbstractDiagram::datasetDimension().

00387 {
00388     // To store the flag for a dataset, we use the first column
00389     // that's associated with it. (i.e., with a dataset dimension
00390     // of two, the column of the keys)
00391     const int column = dataset * datasetDimension();
00392     d->attributesModel->setHeaderData(
00393         column, Qt::Vertical,
00394         qVariantFromValue( hidden ),
00395         DataHiddenRole );
00396     emit dataHidden();
00397 }

void AbstractDiagram::setHidden ( const QModelIndex &  index,
bool  hidden 
) [inherited]

Hide (or unhide, resp.

) a data cell.

Note:
Hidden data are still taken into account by the coordinate plane, so neither the grid nor your axes' ranges will change, when you hide data. For totally removing data from KD Chart's view you can use another approach: e.g. you could define a proxy model on top of your data model, and register the proxy model calling setModel() instead of registering your real data model.
Parameters:
index The datapoint to set the hidden status for. With a dataset dimension of two, this is the index of the key of each key/value pair.
hidden The hidden status to set.

Definition at line 377 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AbstractDiagram::dataHidden(), and KDChart::DataHiddenRole.

00378 {
00379     d->attributesModel->setData(
00380         conditionallyMapFromSource( index ),
00381         qVariantFromValue( hidden ),
00382         DataHiddenRole );
00383     emit dataHidden();
00384 }

void AbstractDiagram::setModel ( QAbstractItemModel *  model  )  [virtual, inherited]

Associate a model with the diagram.

Reimplemented in KDChart::AbstractCartesianDiagram, and KDChart::LeveyJenningsDiagram.

Definition at line 241 of file KDChartAbstractDiagram.cpp.

References d, KDChart::AttributesModel::initFrom(), KDChart::AbstractDiagram::layoutChanged(), and KDChart::AbstractDiagram::setDataBoundariesDirty().

Referenced by KDChart::AbstractCartesianDiagram::setModel(), and KDChart::Widget::setType().

00242 {
00243     if( model() )
00244     {
00245         disconnect( model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00246         disconnect( model(), SIGNAL( columnsInserted( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00247         disconnect( model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00248         disconnect( model(), SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00249         disconnect( model(), SIGNAL( modelReset() ), this, SLOT( setDataBoundariesDirty() ) );
00250         disconnect( model(), SIGNAL( layoutChanged() ), this, SLOT( setDataBoundariesDirty() ) );
00251     }
00252     QAbstractItemView::setModel( newModel );
00253     AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
00254     amodel->initFrom( d->attributesModel );
00255     d->setAttributesModel(amodel);
00256     scheduleDelayedItemsLayout();
00257     setDataBoundariesDirty();
00258     if( model() )
00259     {
00260         connect( model(), SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00261         connect( model(), SIGNAL( columnsInserted( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00262         connect( model(), SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00263         connect( model(), SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( setDataBoundariesDirty() ) );
00264         connect( model(), SIGNAL( modelReset() ), this, SLOT( setDataBoundariesDirty() ) );
00265         connect( model(), SIGNAL( layoutChanged() ), this, SLOT( setDataBoundariesDirty() ) );
00266     }
00267 }

void AbstractDiagram::setPen ( const QPen &  pen  )  [inherited]

Set the pen to be used, for painting all datasets in the model.

Parameters:
pen The pen to use.

Definition at line 750 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setModelData().

00751 {
00752     attributesModel()->setModelData(
00753         qVariantFromValue( pen ), DatasetPenRole );
00754     emit propertiesChanged();
00755 }

void AbstractDiagram::setPen ( int  dataset,
const QPen &  pen 
) [inherited]

Set the pen to be used, for painting the given dataset.

Parameters:
dataset The dataset to set the pen for.
pen The pen to use.

Definition at line 757 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::datasetDimension(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setHeaderData().

00758 {
00759     // To store the pen for a dataset, we use the first column
00760     // that's associated with it. (i.e., with a dataset dimension
00761     // of two, the column of the keys)
00762     const int column = dataset * datasetDimension();
00763     
00764     attributesModel()->setHeaderData(
00765         column, Qt::Vertical,
00766         qVariantFromValue( pen ),
00767         DatasetPenRole );
00768     emit propertiesChanged();
00769 }

void AbstractDiagram::setPen ( const QModelIndex &  index,
const QPen &  pen 
) [inherited]

Set the pen to be used, for painting the datapoint at the given index.

Parameters:
index The datapoint's index in the model. With a dataset dimension of two, this is the index of the key of each key/value pair.
pen The pen to use.

Definition at line 742 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModel(), KDChart::DatasetPenRole, KDChart::AbstractDiagram::propertiesChanged(), and KDChart::AttributesModel::setData().

Referenced by StockDiagram::init().

00743 {
00744     attributesModel()->setData(
00745         conditionallyMapFromSource( index ),
00746         qVariantFromValue( pen ), DatasetPenRole );
00747     emit propertiesChanged();
00748 }

void AbstractDiagram::setPercentMode ( bool  percent  )  [inherited]

Definition at line 527 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::propertiesChanged().

Referenced by KDChart::BarDiagram::setOrientation(), KDChart::LineDiagram::setType(), and KDChart::BarDiagram::setType().

00528 {
00529     d->percent = percent;
00530     emit propertiesChanged();
00531 }

void AbstractPieDiagram::setPieAttributes ( const QModelIndex &  index,
const PieAttributes a 
) [inherited]

Definition at line 125 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::PieAttributesRole.

00126 {
00127         d->attributesModel->setData( index, qVariantFromValue( attrs), PieAttributesRole );
00128         emit layoutChanged( this );
00129 }

void AbstractPieDiagram::setPieAttributes ( int  column,
const PieAttributes a 
) [inherited]

Definition at line 118 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::PieAttributesRole.

00119 {
00120     d->attributesModel->setHeaderData(
00121         column, Qt::Vertical, qVariantFromValue( attrs ), PieAttributesRole );
00122     emit layoutChanged( this );
00123 }

void AbstractPieDiagram::setPieAttributes ( const PieAttributes a  )  [inherited]

Definition at line 112 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::PieAttributesRole.

00113 {
00114     d->attributesModel->setModelData( qVariantFromValue( attrs ), PieAttributesRole );
00115     emit layoutChanged( this );
00116 }

void AbstractDiagram::setRootIndex ( const QModelIndex &  idx  )  [virtual, inherited]

Set the root index in the model, where the diagram starts referencing data for display.

[reimplemented]

Reimplemented in KDChart::AbstractCartesianDiagram.

Definition at line 329 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AbstractDiagram::setAttributesModelRootIndex().

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

00330 {
00331     QAbstractItemView::setRootIndex(idx);
00332     setAttributesModelRootIndex( d->attributesModel->mapFromSource(idx) );
00333 }

void AbstractDiagram::setSelection ( const QRect &  rect,
QItemSelectionModel::SelectionFlags  command 
) [virtual, inherited]

[reimplemented]

Definition at line 967 of file KDChartAbstractDiagram.cpp.

References d.

00968 {
00969     const QModelIndexList indexes = d->indexesIn( rect );
00970     QItemSelection selection;
00971     KDAB_FOREACH( const QModelIndex& index, indexes )
00972     {
00973         selection.append( QItemSelectionRange( index ) );
00974     }
00975     selectionModel()->select( selection, command );
00976 }

void AbstractDiagram::setSelectionModel ( QItemSelectionModel *  selectionModel  )  [virtual, inherited]

Associate a seleection model with the diagrom.

Definition at line 269 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::modelsChanged().

00270 {
00271     if( selectionModel() )
00272     {
00273         disconnect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( modelsChanged() ) );
00274         disconnect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( modelsChanged() ) );
00275     }
00276     QAbstractItemView::setSelectionModel( newSelectionModel );
00277     if( selectionModel() )
00278     {
00279         connect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( modelsChanged() ) );
00280         connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( modelsChanged() ) );
00281     }
00282     emit modelsChanged();
00283 }

void AbstractPieDiagram::setStartPosition ( int  degrees  )  [inherited]

Deprecated:
Use PolarCoordinatePlane::setStartPosition( qreal degrees ) instead.

Definition at line 100 of file KDChartAbstractPieDiagram.cpp.

00101 {
00102     Q_UNUSED( degrees );
00103     qWarning() << "Deprecated AbstractPieDiagram::setStartPosition() called, setting ignored.";
00104 }

void AbstractPieDiagram::setThreeDPieAttributes ( const QModelIndex &  index,
const ThreeDPieAttributes a 
) [inherited]

Definition at line 175 of file KDChartAbstractPieDiagram.cpp.

References KDChart::AbstractDiagram::layoutChanged(), and KDChart::ThreeDPieAttributesRole.

00176 {
00177     model()->setData( index, qVariantFromValue( tda ), ThreeDPieAttributesRole );
00178     emit layoutChanged( this );
00179 }

void AbstractPieDiagram::setThreeDPieAttributes ( int  column,
const ThreeDPieAttributes a 
) [inherited]

Definition at line 168 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::ThreeDPieAttributesRole.

00169 {
00170     d->attributesModel->setHeaderData(
00171         column, Qt::Vertical, qVariantFromValue( tda ), ThreeDPieAttributesRole );
00172     emit layoutChanged( this );
00173 }

void AbstractPieDiagram::setThreeDPieAttributes ( const ThreeDPieAttributes a  )  [inherited]

Definition at line 162 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractDiagram::layoutChanged(), and KDChart::ThreeDPieAttributesRole.

00163 {
00164     d->attributesModel->setModelData( qVariantFromValue( tda ), ThreeDPieAttributesRole );
00165     emit layoutChanged( this );
00166 }

void AbstractDiagram::setUnitPrefix ( const QString &  prefix,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for all columns.

Sets the unit prefix for all values.

Parameters:
prefix The prefix to be used.
orientation The orientation of the axis to use.
prefix the prefix to be set
orientation the orientantion of the axis to set

Definition at line 872 of file KDChartAbstractDiagram.cpp.

References d.

00873 {
00874     d->unitPrefix[ orientation ] = prefix;
00875 }

void AbstractDiagram::setUnitPrefix ( const QString &  prefix,
int  column,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for one specific column.

Sets the unit prefix for one value.

Parameters:
prefix The prefix to be used.
column The column which should be set.
orientation The orientation of the axis to use.
prefix the prefix to be set
column the value using that prefix
orientation the orientantion of the axis to set

Definition at line 862 of file KDChartAbstractDiagram.cpp.

References d.

00863 {
00864     d->unitPrefixMap[ column ][ orientation ]= prefix;
00865 }

void AbstractDiagram::setUnitSuffix ( const QString &  suffix,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for all columns.

Sets the unit suffix for all values.

Parameters:
suffix The suffix to be used.
orientation The orientation of the axis to use.
suffix the suffix to be set
orientation the orientantion of the axis to set

Definition at line 893 of file KDChartAbstractDiagram.cpp.

References d.

00894 {
00895     d->unitSuffix[ orientation ] = suffix;
00896 }

void AbstractDiagram::setUnitSuffix ( const QString &  suffix,
int  column,
Qt::Orientation  orientation 
) [inherited]

Set the unit prefix to be used on axes for one specific column.

Sets the unit suffix for one value.

Parameters:
suffix The suffix to be used.
column The column which should be set.
orientation The orientation of the axis to use.
suffix the suffix to be set
column the value using that suffix
orientation the orientantion of the axis to set

Definition at line 883 of file KDChartAbstractDiagram.cpp.

References d.

00884 {
00885     d->unitSuffixMap[ column ][ orientation ]= suffix;
00886 }

int AbstractPieDiagram::startPosition (  )  const [inherited]

Deprecated:
Use qreal PolarCoordinatePlane::startPosition instead.

Definition at line 106 of file KDChartAbstractPieDiagram.cpp.

Referenced by KDChart::AbstractPieDiagram::compare().

00107 {
00108     qWarning() << "Deprecated AbstractPieDiagram::startPosition() called.";
00109     return 0;
00110 }

ThreeDPieAttributes AbstractPieDiagram::threeDPieAttributes ( const QModelIndex &  index  )  const [inherited]

Definition at line 203 of file KDChartAbstractPieDiagram.cpp.

References d, and KDChart::ThreeDPieAttributesRole.

00204 {
00205     return qVariantValue<ThreeDPieAttributes>(
00206         d->attributesModel->data(
00207             d->attributesModel->mapFromSource( index ),
00208             ThreeDPieAttributesRole ) );
00209 }

ThreeDPieAttributes AbstractPieDiagram::threeDPieAttributes ( int  column  )  const [inherited]

Definition at line 193 of file KDChartAbstractPieDiagram.cpp.

References d, KDChart::AbstractPieDiagram::threeDPieAttributes(), and KDChart::ThreeDPieAttributesRole.

00194 {
00195     const QVariant attrs(
00196             d->attributesModel->headerData( column, Qt::Vertical,
00197                                             ThreeDPieAttributesRole ) );
00198     if( attrs.isValid() )
00199         return qVariantValue< ThreeDPieAttributes >( attrs );
00200     return threeDPieAttributes();
00201 }

ThreeDPieAttributes AbstractPieDiagram::threeDPieAttributes (  )  const [inherited]

Definition at line 184 of file KDChartAbstractPieDiagram.cpp.

References d, and KDChart::ThreeDPieAttributesRole.

Referenced by paintInternal(), and KDChart::AbstractPieDiagram::threeDPieAttributes().

00185 {
00186     return qVariantValue<ThreeDPieAttributes>(
00187         d->attributesModel->data( ThreeDPieAttributesRole ) );
00188 }

QString AbstractDiagram::unitPrefix ( Qt::Orientation  orientation  )  const [inherited]

Retrieves the axis unit prefix.

Returns the global unit prefix.

Parameters:
orientation The orientation of the axis.
Returns:
The axis unit prefix.
Parameters:
orientation the orientation of the axis
Returns:
the unit prefix

Definition at line 916 of file KDChartAbstractDiagram.cpp.

References d.

00917 {
00918     return d->unitPrefix[ orientation ];
00919 }

QString AbstractDiagram::unitPrefix ( int  column,
Qt::Orientation  orientation,
bool  fallback = false 
) const [inherited]

Retrieves the axis unit prefix for a specific column.

Returns the unit prefix for a special value.

Parameters:
column The column whose prefix should be retrieved.
orientation The orientation of the axis.
fallback If true, the prefix for all columns is returned, when none is set for the selected column.
Returns:
The axis unit prefix.
Parameters:
column the value which's prefix is requested
orientation the orientation of the axis
fallback if true, the global prefix is return when no specific one is set for that value
Returns:
the unit prefix

Definition at line 905 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::itemRowLabels(), and KDChart::CartesianAxis::paintCtx().

00906 {
00907     if( !fallback || d->unitPrefixMap[ column ].contains( orientation ) )
00908         return d->unitPrefixMap[ column ][ orientation ];
00909     return d->unitPrefix[ orientation ];
00910 }

QString AbstractDiagram::unitSuffix ( Qt::Orientation  orientation  )  const [inherited]

Retrieves the axis unit suffix.

Returns the global unit suffix.

Parameters:
orientation The orientation of the axis.
Returns:
The axis unit suffix.
Parameters:
orientation the orientation of the axis
Returns:
the unit siffix

Definition at line 939 of file KDChartAbstractDiagram.cpp.

References d.

00940 {
00941     return d->unitSuffix[ orientation ];
00942 }

QString AbstractDiagram::unitSuffix ( int  column,
Qt::Orientation  orientation,
bool  fallback = false 
) const [inherited]

Retrieves the axis unit suffix for a specific column.

Returns the unit suffix for a special value.

Parameters:
column The column whose prefix should be retrieved.
orientation The orientation of the axis.
fallback If true, the suffix for all columns is returned, when none is set for the selected column.
Returns:
The axis unit suffix.
Parameters:
column the value which's suffix is requested
orientation the orientation of the axis
fallback if true, the global suffix is return when no specific one is set for that value
Returns:
the unit suffix

Definition at line 928 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::itemRowLabels(), and KDChart::CartesianAxis::paintCtx().

00929 {
00930     if( !fallback || d->unitSuffixMap[ column ].contains( orientation ) )
00931         return d->unitSuffixMap[ column ][ orientation ];
00932     return d->unitSuffix[ orientation ];
00933 }

void AbstractDiagram::update (  )  const [inherited]

Definition at line 1116 of file KDChartAbstractDiagram.cpp.

References d.

Referenced by KDChart::AbstractDiagram::doItemsLayout(), KDChart::LeveyJenningsDiagram::setExpectedMeanValue(), KDChart::LeveyJenningsDiagram::setExpectedStandardDeviation(), KDChart::LeveyJenningsDiagram::setFluidicsPackChangedSymbolPosition(), KDChart::LeveyJenningsDiagram::setFluidicsPackChanges(), KDChart::LeveyJenningsDiagram::setLotChangedSymbolPosition(), KDChart::LeveyJenningsDiagram::setScanLinePen(), KDChart::LeveyJenningsDiagram::setSensorChangedSymbolPosition(), KDChart::LeveyJenningsDiagram::setSensorChanges(), KDChart::LeveyJenningsDiagram::setSymbol(), and KDChart::LeveyJenningsDiagram::setTimeRange().

01117 {
01118     //qDebug("KDChart::AbstractDiagram::update() called");
01119     if( d->plane )
01120         d->plane->update();
01121 }

void KDChart::AbstractDiagram::useDefaultColors (  )  [inherited]

Set the palette to be used, for painting datasets to the default palette.

See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method

Definition at line 994 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AttributesModel::PaletteTypeDefault.

00995 {
00996     d->attributesModel->setPaletteType( AttributesModel::PaletteTypeDefault );
00997 }

void KDChart::AbstractDiagram::useRainbowColors (  )  [inherited]

Set the palette to be used, for painting datasets to the rainbow palette.

See also:
KDChart::Palette.

Definition at line 1004 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AttributesModel::PaletteTypeRainbow.

01005 {
01006     d->attributesModel->setPaletteType( AttributesModel::PaletteTypeRainbow );
01007 }

bool AbstractDiagram::usesExternalAttributesModel (  )  const [virtual, inherited]

Returns whether the diagram is using its own built-in attributes model or an attributes model that was set via setAttributesModel.

See also:
setAttributesModel

Definition at line 309 of file KDChartAbstractDiagram.cpp.

References d.

00310 {
00311     return d->usesExternalAttributesModel();
00312 }

void KDChart::AbstractDiagram::useSubduedColors (  )  [inherited]

Set the palette to be used, for painting datasets to the subdued palette.

See also:
KDChart::Palette.

Definition at line 999 of file KDChartAbstractDiagram.cpp.

References d, and KDChart::AttributesModel::PaletteTypeSubdued.

01000 {
01001     d->attributesModel->setPaletteType( AttributesModel::PaletteTypeSubdued );
01002 }

double AbstractDiagram::valueForCell ( int  row,
int  column 
) const [protected, inherited]

Helper method, retrieving the data value (DisplayRole) for a given row and column.

Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
Deprecated:

Definition at line 1110 of file KDChartAbstractDiagram.cpp.

References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.

01111 {
01112     return d->attributesModel->data(
01113             d->attributesModel->index( row, column, attributesModelRootIndex() ) ).toDouble();
01114 }

double PieDiagram::valueTotals (  )  const [virtual]

[reimplemented]

Implements KDChart::AbstractPolarDiagram.

Definition at line 1061 of file KDChartPieDiagram.cpp.

References KDChart::AbstractPolarDiagram::columnCount().

Referenced by paintInternal().

01062 {
01063     const int colCount = columnCount();
01064     double total = 0.0;
01065     for ( int j = 0; j < colCount; ++j ) {
01066       total += qAbs(model()->data( model()->index( 0, j, rootIndex() ) ).toDouble());
01067       //qDebug() << model()->data( model()->index( 0, j, rootIndex() ) ).toDouble();
01068     }
01069     return total;
01070 }

int AbstractDiagram::verticalOffset (  )  const [virtual, inherited]

[reimplemented]

Definition at line 961 of file KDChartAbstractDiagram.cpp.

00962 { return 0; }

QRect AbstractDiagram::visualRect ( const QModelIndex &  index  )  const [virtual, inherited]

[reimplemented]

Definition at line 945 of file KDChartAbstractDiagram.cpp.

References d.

00946 {
00947     return d->reverseMapper.boundingRect( index.row(), index.column() ).toRect();
00948 }

QRegion AbstractDiagram::visualRegion ( const QModelIndex &  index  )  const [virtual, inherited]

Definition at line 988 of file KDChartAbstractDiagram.cpp.

References d.

00989 {
00990     QPolygonF polygon = d->reverseMapper.polygon(index.row(), index.column());
00991     return polygon.isEmpty() ? QRegion() : QRegion( polygon.toPolygon() );
00992 }

QRegion AbstractDiagram::visualRegionForSelection ( const QItemSelection &  selection  )  const [virtual, inherited]

[reimplemented]

Definition at line 978 of file KDChartAbstractDiagram.cpp.

References d.

00979 {
00980     QPolygonF polygon;
00981     KDAB_FOREACH( const QModelIndex& index, selection.indexes() )
00982     {
00983         polygon << d->reverseMapper.polygon(index.row(), index.column());
00984     }
00985     return polygon.isEmpty() ? QRegion() : QRegion( polygon.toPolygon() );
00986 }


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