#include <KDChartLegend.h>
Legend is the class for drawing legends for all kinds of diagrams ("chart types").
Legend is drawn on chart level, not per diagram, but you can have more than one legend per chart, using KDChart::Chart::addLegend().
Definition at line 62 of file KDChartLegend.h.
Public Types | |
enum | LegendStyle { MarkersOnly = 0, LinesOnly = 1, MarkersAndLines = 2 } |
Signals | |
void | destroyedLegend (Legend *) |
void | positionChanged (AbstractAreaWidget *) |
void | propertiesChanged () |
Emitted upon change of a property of the Legend or any of its components. | |
Public Member Functions | |
void | addDiagram (KDChart::AbstractDiagram *newDiagram) |
Add the given diagram to the legend. | |
Qt::Alignment | alignment () const |
Returns the alignment of a non-floating legend. | |
void | alignToReferencePoint (const RelativePosition &position) |
BackgroundAttributes | backgroundAttributes () const |
QBrush | brush (uint dataset) const |
const QMap< uint, QBrush > | brushes () const |
virtual Legend * | clone () const |
Creates an exact copy of this legend. | |
bool | compare (const AbstractAreaBase *other) const |
Returns true if both areas have the same settings. | |
bool | compare (const Legend *other) const |
Returns true if both legends have the same settings. | |
ConstDiagramList | constDiagrams () const |
| |
uint | datasetCount () const |
bool | datasetIsHidden (uint dataset) const |
uint | dataSetOffset (KDChart::AbstractDiagram *diagram) |
Returns the offset of the first dataset of diagram . | |
KDChart::AbstractDiagram * | diagram () const |
The first diagram of the legend or 0 if there was none added to the legend. | |
DiagramList | diagrams () const |
The list of all diagrams associated with the legend. | |
const RelativePosition | floatingPosition () const |
Returns the position of a floating legend. | |
virtual void | forceRebuild () |
Call this to trigger an unconditional re-building of the widget's internals. | |
FrameAttributes | frameAttributes () const |
void | getFrameLeadings (int &left, int &top, int &right, int &bottom) const |
const QList< uint > | hiddenDatasets () const |
Legend (KDChart::AbstractDiagram *diagram, QWidget *parent) | |
Legend (QWidget *parent=0) | |
LegendStyle | legendStyle () const |
const QMap< uint, MarkerAttributes > | markerAttributes () const |
MarkerAttributes | markerAttributes (uint dataset) const |
virtual QSize | minimumSizeHint () const |
virtual void | needSizeHint () |
Call this to trigger an conditional re-building of the widget's internals. | |
Qt::Orientation | orientation () const |
virtual void | paint (QPainter *painter) |
Overwrite this to paint the inner contents of your widget. | |
void | paintAll (QPainter &painter) |
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically. | |
virtual void | paintBackground (QPainter &painter, const QRect &rectangle) |
virtual void | paintEvent (QPaintEvent *event) |
Draws the background and frame, then calls paint(). | |
virtual void | paintFrame (QPainter &painter, const QRect &rectangle) |
virtual void | paintIntoRect (QPainter &painter, const QRect &rect) |
Draws the background and frame, then calls paint(). | |
QPen | pen (uint dataset) const |
const QMap< uint, QPen > | pens () const |
Position | position () const |
Returns the position of a non-floating legend. | |
const QWidget * | referenceArea () const |
Returns the reference area, that is used for font size of title text, and for font size of the item texts, IF automatic area detection is set. | |
void | removeDiagram (KDChart::AbstractDiagram *oldDiagram) |
Removes the diagram from the legend's list of diagrams. | |
void | removeDiagrams () |
Removes all of the diagram from the legend's list of diagrams. | |
void | replaceDiagram (KDChart::AbstractDiagram *newDiagram, KDChart::AbstractDiagram *oldDiagram=0) |
Replaces the old diagram, or appends the new diagram, it there is none yet. | |
void | resetTexts () |
Removes all legend texts that might have been set by setText. | |
virtual void | resizeEvent (QResizeEvent *event) |
virtual void | resizeLayout (const QSize &size) |
void | setAlignment (Qt::Alignment) |
Specify the alignment of a non-floating legend. | |
void | setBackgroundAttributes (const BackgroundAttributes &a) |
void | setBrush (uint dataset, const QBrush &brush) |
void | setBrushesFromDiagram (KDChart::AbstractDiagram *diagram) |
void | setColor (uint dataset, const QColor &color) |
Note: there is no color() getter method, since setColor just sets a QBrush with the respective color, so the brush() getter method is sufficient. | |
void | setDatasetHidden (uint dataset, bool hidden) |
void | setDefaultColors () |
void | setDiagram (KDChart::AbstractDiagram *newDiagram) |
A convenience method doing the same as replaceDiagram( newDiagram, 0 );. | |
void | setFloatingPosition (const RelativePosition &relativePosition) |
Specify the position and alignment of a floating legend. | |
void | setFrameAttributes (const FrameAttributes &a) |
void | setHiddenDatasets (const QList< uint > hiddenDatasets) |
Sets a list of datasets that are to be hidden in the legend. | |
void | setLegendStyle (LegendStyle style) |
void | setMarkerAttributes (uint dataset, const MarkerAttributes &) |
Note that any sizes specified via setMarkerAttributes are ignored, unless you disable the automatic size calculation, by saying setUseAutomaticMarkerSize( false ). | |
void | setOrientation (Qt::Orientation orientation) |
void | setPen (uint dataset, const QPen &pen) |
void | setPosition (Position position) |
Specify the position of a non-floating legend. | |
void | setRainbowColors () |
void | setReferenceArea (const QWidget *area) |
Specifies the reference area for font size of title text, and for font size of the item texts, IF automatic area detection is set. | |
void | setShowLines (bool legendShowLines) |
void | setSortOrder (Qt::SortOrder order) |
void | setSpacing (uint space) |
void | setSubduedColors (bool ordered=false) |
void | setText (uint dataset, const QString &text) |
void | setTextAlignment (Qt::Alignment) |
Specify the alignment of the text elements within the legend. | |
void | setTextAttributes (const TextAttributes &a) |
void | setTitleText (const QString &text) |
void | setTitleTextAttributes (const TextAttributes &a) |
void | setUseAutomaticMarkerSize (bool useAutomaticMarkerSize) |
This option is on by default, it means that Marker sizes in the Legend will be the same as the font height used for their respective label texts. | |
virtual void | setVisible (bool visible) |
bool | showLines () const |
virtual QSize | sizeHint () const |
Qt::SortOrder | sortOrder () const |
uint | spacing () const |
QString | text (uint dataset) const |
Qt::Alignment | textAlignment () const |
Returns the alignment used while rendering text elements within the legend. | |
TextAttributes | textAttributes () const |
const QMap< uint, QString > | texts () const |
QString | titleText () const |
TextAttributes | titleTextAttributes () const |
bool | useAutomaticMarkerSize () const |
virtual | ~Legend () |
Static Public Member Functions | |
static void | paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes) |
static void | paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes) |
Protected Member Functions | |
virtual QRect | areaGeometry () const |
QRect | innerRect () const |
virtual void | positionHasChanged () |
Definition at line 75 of file KDChartLegend.h.
00075 { MarkersOnly = 0, 00076 LinesOnly = 1, 00077 MarkersAndLines = 2 };
Legend::Legend | ( | QWidget * | parent = 0 |
) | [explicit] |
Definition at line 87 of file KDChartLegend.cpp.
References d, and StockDiagram::init().
Referenced by clone().
00087 : 00088 AbstractAreaWidget( new Private(), parent ) 00089 { 00090 d->referenceArea = parent; 00091 init(); 00092 }
Legend::Legend | ( | KDChart::AbstractDiagram * | diagram, | |
QWidget * | parent | |||
) | [explicit] |
Definition at line 94 of file KDChartLegend.cpp.
References d, StockDiagram::init(), and setDiagram().
00094 : 00095 AbstractAreaWidget( new Private(), parent ) 00096 { 00097 d->referenceArea = parent; 00098 init(); 00099 setDiagram( diagram ); 00100 }
Legend::~Legend | ( | ) | [virtual] |
Definition at line 102 of file KDChartLegend.cpp.
References destroyedLegend().
00103 { 00104 emit destroyedLegend( this ); 00105 }
void Legend::addDiagram | ( | KDChart::AbstractDiagram * | newDiagram | ) |
Add the given diagram to the legend.
newDiagram | The diagram to add. |
Definition at line 342 of file KDChartLegend.cpp.
References d.
Referenced by replaceDiagram().
00343 { 00344 if ( newDiagram ) 00345 { 00346 DiagramObserver* observer = new DiagramObserver( newDiagram, this ); 00347 00348 DiagramObserver* oldObs = d->findObserverForDiagram( newDiagram ); 00349 if( oldObs ){ 00350 delete oldObs; 00351 d->observers[ d->observers.indexOf( oldObs ) ] = observer; 00352 }else{ 00353 d->observers.append( observer ); 00354 } 00355 connect( observer, SIGNAL( diagramDestroyed(AbstractDiagram*) ), 00356 SLOT( resetDiagram(AbstractDiagram*) )); 00357 connect( observer, SIGNAL( diagramDataChanged(AbstractDiagram*) ), 00358 SLOT( setNeedRebuild() )); 00359 connect( observer, SIGNAL( diagramDataHidden(AbstractDiagram*) ), 00360 SLOT( setNeedRebuild() )); 00361 connect( observer, SIGNAL( diagramAttributesChanged(AbstractDiagram*) ), 00362 SLOT( setNeedRebuild() )); 00363 setNeedRebuild(); 00364 } 00365 }
Qt::Alignment Legend::alignment | ( | ) | const |
Returns the alignment of a non-floating legend.
Definition at line 476 of file KDChartLegend.cpp.
References d.
Referenced by clone(), and compare().
00477 { 00478 return d->alignment; 00479 }
void AbstractAreaBase::alignToReferencePoint | ( | const RelativePosition & | position | ) | [inherited] |
Definition at line 91 of file KDChartAbstractAreaBase.cpp.
00092 { 00093 Q_UNUSED( position ); 00094 // PENDING(kalle) FIXME 00095 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosition& position )" ); 00096 }
QRect AbstractAreaWidget::areaGeometry | ( | ) | const [protected, virtual, inherited] |
BackgroundAttributes AbstractAreaBase::backgroundAttributes | ( | ) | const [inherited] |
Definition at line 121 of file KDChartAbstractAreaBase.cpp.
References d.
Referenced by KDChart::AbstractAreaBase::compare(), and updateCommonBrush().
00122 { 00123 return d->backgroundAttributes; 00124 }
QBrush Legend::brush | ( | uint | dataset | ) | const |
Definition at line 609 of file KDChartLegend.cpp.
References d.
Referenced by setRainbowColors().
00610 { 00611 if( d->brushes.find( dataset ) != d->brushes.end() ) 00612 return d->brushes[ dataset ]; 00613 else 00614 return d->modelBrushes[ dataset ]; 00615 }
const QMap< uint, QBrush > Legend::brushes | ( | ) | const |
Definition at line 617 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00618 { 00619 return d->brushes; 00620 }
Legend * Legend::clone | ( | ) | const [virtual] |
Creates an exact copy of this legend.
Definition at line 206 of file KDChartLegend.cpp.
References alignment(), d, KDChart::AbstractAreaBase::frameAttributes(), Legend(), legendStyle(), position(), StockDiagram::Private::Private(), setAlignment(), KDChart::AbstractAreaBase::setFrameAttributes(), setLegendStyle(), setPosition(), setTextAlignment(), setTextAttributes(), setTitleTextAttributes(), setUseAutomaticMarkerSize(), textAlignment(), textAttributes(), titleTextAttributes(), and useAutomaticMarkerSize().
00207 { 00208 Legend* legend = new Legend( new Private( *d ), 0 ); 00209 legend->setTextAttributes( textAttributes() ); 00210 legend->setTitleTextAttributes( titleTextAttributes() ); 00211 legend->setFrameAttributes( frameAttributes() ); 00212 legend->setUseAutomaticMarkerSize( useAutomaticMarkerSize() ); 00213 legend->setPosition( position() ); 00214 legend->setAlignment( alignment() ); 00215 legend->setTextAlignment( textAlignment() ); 00216 legend->setLegendStyle( legendStyle() ); 00217 return legend; 00218 }
bool AbstractAreaBase::compare | ( | const AbstractAreaBase * | other | ) | const [inherited] |
Returns true if both areas have the same settings.
Definition at line 76 of file KDChartAbstractAreaBase.cpp.
References KDChart::AbstractAreaBase::backgroundAttributes(), and KDChart::AbstractAreaBase::frameAttributes().
00077 { 00078 if( other == this ) return true; 00079 if( ! other ){ 00080 //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer"; 00081 return false; 00082 } 00083 /* 00084 qDebug() << "AbstractAreaBase:" << (frameAttributes() == other->frameAttributes()) 00085 << (backgroundAttributes() == other->backgroundAttributes()) << "\n"; 00086 */ 00087 return (frameAttributes() == other->frameAttributes()) && 00088 (backgroundAttributes() == other->backgroundAttributes()); 00089 }
bool Legend::compare | ( | const Legend * | other | ) | const |
Returns true if both legends have the same settings.
Definition at line 221 of file KDChartLegend.cpp.
References alignment(), brushes(), floatingPosition(), legendStyle(), markerAttributes(), orientation(), pens(), position(), showLines(), spacing(), textAlignment(), textAttributes(), texts(), titleText(), titleTextAttributes(), and useAutomaticMarkerSize().
00222 { 00223 if( other == this ) return true; 00224 if( ! other ){ 00225 //qDebug() << "Legend::compare() cannot compare to Null pointer"; 00226 return false; 00227 } 00228 00229 qDebug() << ( static_cast<const AbstractAreaBase*>(this)->compare( other ) ); 00230 qDebug() << (isVisible() == other->isVisible()); 00231 qDebug() << (position() == other->position()); 00232 qDebug() << (alignment() == other->alignment()); 00233 qDebug() << (textAlignment() == other->textAlignment()); 00234 qDebug() << (floatingPosition() == other->floatingPosition()); 00235 qDebug() << (orientation() == other->orientation()); 00236 qDebug() << (showLines() == other->showLines()); 00237 qDebug() << (texts() == other->texts()); 00238 qDebug() << (brushes() == other->brushes()); 00239 qDebug() << (pens() == other->pens()); 00240 qDebug() << (markerAttributes() == other->markerAttributes()); 00241 qDebug() << (useAutomaticMarkerSize() == other->useAutomaticMarkerSize()); 00242 qDebug() << (textAttributes() == other->textAttributes()); 00243 qDebug() << (titleText() == other->titleText()); 00244 qDebug() << (titleTextAttributes() == other->titleTextAttributes()); 00245 qDebug() << (spacing() == other->spacing()); 00246 qDebug() << (legendStyle() == other->legendStyle()); 00247 00248 return ( static_cast<const AbstractAreaBase*>(this)->compare( other ) ) && 00249 (isVisible() == other->isVisible()) && 00250 (position() == other->position()) && 00251 (alignment() == other->alignment())&& 00252 (textAlignment() == other->textAlignment())&& 00253 (floatingPosition() == other->floatingPosition()) && 00254 (orientation() == other->orientation())&& 00255 (showLines() == other->showLines())&& 00256 (texts() == other->texts())&& 00257 (brushes() == other->brushes())&& 00258 (pens() == other->pens())&& 00259 (markerAttributes() == other->markerAttributes())&& 00260 (useAutomaticMarkerSize() == other->useAutomaticMarkerSize()) && 00261 (textAttributes() == other->textAttributes()) && 00262 (titleText() == other->titleText())&& 00263 (titleTextAttributes() == other->titleTextAttributes()) && 00264 (spacing() == other->spacing()) && 00265 (legendStyle() == other->legendStyle()); 00266 }
ConstDiagramList Legend::constDiagrams | ( | ) | const |
Definition at line 334 of file KDChartLegend.cpp.
References d.
00335 { 00336 ConstDiagramList list; 00337 for (int i = 0; i < d->observers.size(); ++i) 00338 list << d->observers.at(i)->diagram(); 00339 return list; 00340 }
uint Legend::datasetCount | ( | ) | const |
Definition at line 291 of file KDChartLegend.cpp.
References d, KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), and KDChart::DiagramObserver::diagram().
00292 { 00293 int modelLabelsCount = 0; 00294 int modelBrushesCount = 0; 00295 for (int i = 0; i < d->observers.size(); ++i) { 00296 DiagramObserver * obs = d->observers.at(i); 00297 modelLabelsCount += obs->diagram()->datasetLabels().count(); 00298 modelBrushesCount += obs->diagram()->datasetBrushes().count(); 00299 } 00300 Q_ASSERT( modelLabelsCount == modelBrushesCount ); 00301 return modelLabelsCount; 00302 }
bool Legend::datasetIsHidden | ( | uint | dataset | ) | const |
Definition at line 1124 of file KDChartLegend.cpp.
References d.
01125 { 01126 return d->hiddenDatasets.contains( dataset ); 01127 }
uint Legend::dataSetOffset | ( | KDChart::AbstractDiagram * | diagram | ) |
Returns the offset of the first dataset of diagram
.
Definition at line 403 of file KDChartLegend.cpp.
References d.
00404 { 00405 uint offset = 0; 00406 00407 for (int i = 0; i < d->observers.count(); ++i) 00408 { 00409 if(d->observers.at(i)->diagram() == diagram) 00410 return offset; 00411 00412 KDChart::AbstractDiagram* diagram = d->observers.at(i)->diagram(); 00413 if(!diagram->model()) 00414 continue; 00415 00416 offset = offset + diagram->model()->columnCount(); 00417 } 00418 00419 return offset; 00420 }
AbstractDiagram * Legend::diagram | ( | ) | const |
The first diagram of the legend or 0 if there was none added to the legend.
Definition at line 319 of file KDChartLegend.cpp.
References d.
Referenced by paint().
00320 { 00321 if( d->observers.isEmpty() ) 00322 return 0; 00323 return d->observers.first()->diagram(); 00324 }
DiagramList Legend::diagrams | ( | ) | const |
The list of all diagrams associated with the legend.
Definition at line 326 of file KDChartLegend.cpp.
References d.
00327 { 00328 DiagramList list; 00329 for (int i = 0; i < d->observers.size(); ++i) 00330 list << d->observers.at(i)->diagram(); 00331 return list; 00332 }
const RelativePosition Legend::floatingPosition | ( | ) | const |
Returns the position of a floating legend.
Definition at line 503 of file KDChartLegend.cpp.
References d.
Referenced by compare(), and KDChart::Chart::reLayoutFloatingLegends().
00504 { 00505 return d->relativePosition; 00506 }
void Legend::forceRebuild | ( | ) | [virtual] |
Call this to trigger an unconditional re-building of the widget's internals.
Reimplemented from KDChart::AbstractAreaWidget.
Definition at line 721 of file KDChartLegend.cpp.
Referenced by resizeEvent().
00722 { 00723 #ifdef DEBUG_LEGEND_PAINT 00724 qDebug() << "entering Legend::forceRebuild()"; 00725 #endif 00726 //setSpacing(d->layout->spacing()); 00727 buildLegend(); 00728 #ifdef DEBUG_LEGEND_PAINT 00729 qDebug() << "leaving Legend::forceRebuild()"; 00730 #endif 00731 }
FrameAttributes AbstractAreaBase::frameAttributes | ( | ) | const [inherited] |
Definition at line 107 of file KDChartAbstractAreaBase.cpp.
References d.
Referenced by clone(), KDChart::AbstractAreaBase::compare(), and updateCommonBrush().
00108 { 00109 return d->frameAttributes; 00110 }
void AbstractAreaBase::getFrameLeadings | ( | int & | left, | |
int & | top, | |||
int & | right, | |||
int & | bottom | |||
) | const [inherited] |
Definition at line 213 of file KDChartAbstractAreaBase.cpp.
References d.
Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().
00214 { 00215 if( d && d->frameAttributes.isVisible() ){ 00216 const int padding = qMax( d->frameAttributes.padding(), 0 ); 00217 left = padding; 00218 top = padding; 00219 right = padding; 00220 bottom = padding; 00221 }else{ 00222 left = 0; 00223 top = 0; 00224 right = 0; 00225 bottom = 0; 00226 } 00227 }
const QList< uint > Legend::hiddenDatasets | ( | ) | const |
Definition at line 1111 of file KDChartLegend.cpp.
References d.
01112 { 01113 return d->hiddenDatasets; 01114 }
QRect AbstractAreaBase::innerRect | ( | ) | const [protected, inherited] |
Definition at line 229 of file KDChartAbstractAreaBase.cpp.
References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings().
Referenced by KDChart::TextArea::paintAll(), and KDChart::AbstractArea::paintAll().
00230 { 00231 int left; 00232 int top; 00233 int right; 00234 int bottom; 00235 getFrameLeadings( left, top, right, bottom ); 00236 return 00237 QRect( QPoint(0,0), areaGeometry().size() ) 00238 .adjusted( left, top, -right, -bottom ); 00239 }
Legend::LegendStyle Legend::legendStyle | ( | ) | const |
const QMap< uint, MarkerAttributes > Legend::markerAttributes | ( | ) | const |
Definition at line 679 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00680 { 00681 return d->markerAttributes; 00682 }
MarkerAttributes Legend::markerAttributes | ( | uint | dataset | ) | const |
Definition at line 670 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00671 { 00672 if( d->markerAttributes.find( dataset ) != d->markerAttributes.end() ) 00673 return d->markerAttributes[ dataset ]; 00674 else if ( static_cast<uint>( d->modelMarkers.count() ) > dataset ) 00675 return d->modelMarkers[ dataset ]; 00676 return MarkerAttributes(); 00677 }
QSize Legend::minimumSizeHint | ( | ) | const [virtual] |
Definition at line 145 of file KDChartLegend.cpp.
References sizeHint().
00146 { 00147 return sizeHint(); 00148 }
void Legend::needSizeHint | ( | ) | [virtual] |
Call this to trigger an conditional re-building of the widget's internals.
e.g. AbstractAreaWidget call this, before calling layout()->setGeometry()
Reimplemented from KDChart::AbstractAreaWidget.
Definition at line 163 of file KDChartLegend.cpp.
00164 { 00165 // Re-build the Legend's content, if it has not been build yet, 00166 // or if the Legend's geometry has changed, resp. 00167 buildLegend(); 00168 }
Qt::Orientation Legend::orientation | ( | ) | const |
Definition at line 516 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00517 { 00518 return d->orientation; 00519 }
void Legend::paint | ( | QPainter * | painter | ) | [virtual] |
Overwrite this to paint the inner contents of your widget.
Implements KDChart::AbstractAreaWidget.
Definition at line 269 of file KDChartLegend.cpp.
References d, diagram(), and KDChart::AbstractLayoutItem::paint().
00270 { 00271 #ifdef DEBUG_LEGEND_PAINT 00272 qDebug() << "entering Legend::paint( QPainter* painter )"; 00273 #endif 00274 // rule: We do not show a legend, if there is no diagram. 00275 if( ! diagram() ) return; 00276 00277 // re-calculate/adjust the Legend's internal layout and contents, if needed: 00278 //buildLegend(); 00279 00280 // PENDING(kalle) Support palette 00281 00282 Q_FOREACH( KDChart::AbstractLayoutItem* layoutItem, d->layoutItems ) { 00283 layoutItem->paint( painter ); 00284 } 00285 #ifdef DEBUG_LEGEND_PAINT 00286 qDebug() << "leaving Legend::paint( QPainter* painter )"; 00287 #endif 00288 }
void AbstractAreaWidget::paintAll | ( | QPainter & | painter | ) | [inherited] |
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.
Definition at line 145 of file KDChartAbstractAreaWidget.cpp.
References KDChart::AbstractAreaBase::getFrameLeadings(), KDChart::AbstractAreaWidget::paint(), KDChart::AbstractAreaBase::paintBackground(), and KDChart::AbstractAreaBase::paintFrame().
Referenced by KDChart::AbstractAreaWidget::paintEvent(), and KDChart::AbstractAreaWidget::paintIntoRect().
00146 { 00147 //qDebug() << "AbstractAreaWidget::paintAll() called"; 00148 00149 // Paint the background and frame 00150 paintBackground( painter, QRect(QPoint(0, 0), size() ) ); 00151 paintFrame( painter, QRect(QPoint(0, 0), size() ) ); 00152 00153 /* 00154 we do not call setContentsMargins() now, 00155 but we call resizeLayout() whenever the size or the frame has changed 00156 00157 // adjust the widget's content margins, 00158 // to be sure all content gets calculated 00159 // to fit into the inner rectangle 00160 const QRect oldGeometry( areaGeometry() ); 00161 const QRect inner( innerRect() ); 00162 //qDebug() << "areaGeometry():" << oldGeometry 00163 // << " contentsRect():" << contentsRect() << " inner:" << inner; 00164 if( contentsRect() != inner ){ 00165 //qDebug() << "old contentsRect():" << contentsRect() << " new innerRect:" << inner; 00166 setContentsMargins( 00167 inner.left(), 00168 inner.top(), 00169 oldGeometry.width() -inner.width()-1, 00170 oldGeometry.height()-inner.height()-1 ); 00171 //forceRebuild(); 00172 } 00173 */ 00174 int left; 00175 int top; 00176 int right; 00177 int bottom; 00178 getFrameLeadings( left, top, right, bottom ); 00179 const QPoint translation( left, top ); 00180 painter.translate( translation ); 00181 paint( &painter ); 00182 painter.translate( -translation.x(), -translation.y() ); 00183 //qDebug() << "AbstractAreaWidget::paintAll() done."; 00184 }
void AbstractAreaBase::paintBackground | ( | QPainter & | painter, | |
const QRect & | rectangle | |||
) | [virtual, inherited] |
Definition at line 197 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes().
Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().
00198 { 00199 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()", 00200 "Private class was not initialized!" ); 00201 paintBackgroundAttributes( painter, rect, d->backgroundAttributes ); 00202 }
void AbstractAreaBase::paintBackgroundAttributes | ( | QPainter & | painter, | |
const QRect & | rectangle, | |||
const KDChart::BackgroundAttributes & | attributes | |||
) | [static, inherited] |
Definition at line 128 of file KDChartAbstractAreaBase.cpp.
References KDChart::BackgroundAttributes::BackgroundPixmapModeCentered, KDChart::BackgroundAttributes::BackgroundPixmapModeNone, KDChart::BackgroundAttributes::BackgroundPixmapModeScaled, KDChart::BackgroundAttributes::BackgroundPixmapModeStretched, KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), m, KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode().
Referenced by KDChart::AbstractAreaBase::paintBackground().
00130 { 00131 if( !attributes.isVisible() ) return; 00132 00133 /* first draw the brush (may contain a pixmap)*/ 00134 if( Qt::NoBrush != attributes.brush().style() ) { 00135 KDChart::PainterSaver painterSaver( &painter ); 00136 painter.setPen( Qt::NoPen ); 00137 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) ); 00138 painter.setBrushOrigin( newTopLeft ); 00139 painter.setBrush( attributes.brush() ); 00140 painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) ); 00141 } 00142 /* next draw the backPixmap over the brush */ 00143 if( !attributes.pixmap().isNull() && 00144 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) { 00145 QPointF ol = rect.topLeft(); 00146 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() ) 00147 { 00148 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 ); 00149 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 ); 00150 painter.drawPixmap( ol, attributes.pixmap() ); 00151 } else { 00152 QMatrix m; 00153 double zW = (double)rect.width() / (double)attributes.pixmap().width(); 00154 double zH = (double)rect.height() / (double)attributes.pixmap().height(); 00155 switch( attributes.pixmapMode() ) { 00156 case BackgroundAttributes::BackgroundPixmapModeScaled: 00157 { 00158 double z; 00159 z = qMin( zW, zH ); 00160 m.scale( z, z ); 00161 } 00162 break; 00163 case BackgroundAttributes::BackgroundPixmapModeStretched: 00164 m.scale( zW, zH ); 00165 break; 00166 default: 00167 ; // Cannot happen, previously checked 00168 } 00169 QPixmap pm = attributes.pixmap().transformed( m ); 00170 ol.setX( rect.center().x() - pm.width() / 2 ); 00171 ol.setY( rect.center().y() - pm.height()/ 2 ); 00172 painter.drawPixmap( ol, pm ); 00173 } 00174 } 00175 }
void AbstractAreaWidget::paintEvent | ( | QPaintEvent * | event | ) | [virtual, inherited] |
Draws the background and frame, then calls paint().
In most cases there is no need to overwrite this method in a derived class, but you would overwrite paint() instead.
Definition at line 99 of file KDChartAbstractAreaWidget.cpp.
References d, and KDChart::AbstractAreaWidget::paintAll().
00100 { 00101 Q_UNUSED( event ); 00102 QPainter painter( this ); 00103 if( size() != d->currentLayoutSize ){ 00104 d->resizeLayout( this, size() ); 00105 } 00106 paintAll( painter ); 00107 }
void AbstractAreaBase::paintFrame | ( | QPainter & | painter, | |
const QRect & | rectangle | |||
) | [virtual, inherited] |
Definition at line 205 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::paintFrameAttributes().
Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().
00206 { 00207 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()", 00208 "Private class was not initialized!" ); 00209 paintFrameAttributes( painter, rect, d->frameAttributes ); 00210 }
void AbstractAreaBase::paintFrameAttributes | ( | QPainter & | painter, | |
const QRect & | rectangle, | |||
const KDChart::FrameAttributes & | attributes | |||
) | [static, inherited] |
Definition at line 178 of file KDChartAbstractAreaBase.cpp.
References KDChart::FrameAttributes::isVisible(), KDChart::FrameAttributes::pen(), and KDChart::PrintingParameters::scalePen().
Referenced by KDChart::AbstractAreaBase::paintFrame().
00180 { 00181 00182 if( !attributes.isVisible() ) return; 00183 00184 // Note: We set the brush to NoBrush explicitly here. 00185 // Otherwise we might get a filled rectangle, so any 00186 // previously drawn background would be overwritten by that area. 00187 00188 const QPen oldPen( painter.pen() ); 00189 const QBrush oldBrush( painter.brush() ); 00190 painter.setPen( PrintingParameters::scalePen( attributes.pen() ) ); 00191 painter.setBrush( Qt::NoBrush ); 00192 painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) ); 00193 painter.setBrush( oldBrush ); 00194 painter.setPen( oldPen ); 00195 }
void AbstractAreaWidget::paintIntoRect | ( | QPainter & | painter, | |
const QRect & | rect | |||
) | [virtual, inherited] |
Draws the background and frame, then calls paint().
In most cases there is no need to overwrite this method in a derived class, but you would overwrite paint() instead.
Definition at line 109 of file KDChartAbstractAreaWidget.cpp.
References d, and KDChart::AbstractAreaWidget::paintAll().
Referenced by KDChart::Chart::paint().
00110 { 00111 //qDebug() << "AbstractAreaWidget::paintIntoRect() called rect=" << rect; 00112 00113 if( rect.isEmpty() ) return; 00114 00115 d->resizeLayout( this, rect.size() ); 00116 00117 const QPoint translation( rect.topLeft() ); 00118 painter.translate( translation ); 00119 paintAll( painter ); 00120 painter.translate( -translation.x(), -translation.y() ); 00121 00122 /* 00123 // make sure, the contents of the widget have been set up, 00124 // so we get a useful geometry: 00125 needSizeHint(); 00126 00127 const QRect oldGeometry( layout()->geometry() ); 00128 const QRect newGeo( QPoint(0,0), rect.size() ); 00129 const bool mustChangeGeo = layout() && oldGeometry != newGeo; 00130 if( mustChangeGeo ) 00131 layout()->setGeometry( newGeo ); 00132 painter.translate( rect.left(), rect.top() ); 00133 paintAll( painter ); 00134 painter.translate( -rect.left(), -rect.top() ); 00135 if( mustChangeGeo ) 00136 layout()->setGeometry( oldGeometry ); 00137 */ 00138 }
QPen Legend::pen | ( | uint | dataset | ) | const |
const QMap< uint, QPen > Legend::pens | ( | ) | const |
Definition at line 656 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00657 { 00658 return d->pens; 00659 }
Position Legend::position | ( | ) | const |
Returns the position of a non-floating legend.
Definition at line 463 of file KDChartLegend.cpp.
References d.
Referenced by clone(), compare(), and KDChart::Chart::reLayoutFloatingLegends().
00464 { 00465 return d->position; 00466 }
void KDChart::AbstractAreaWidget::positionChanged | ( | AbstractAreaWidget * | ) | [signal, inherited] |
Referenced by KDChart::AbstractAreaWidget::positionHasChanged().
void AbstractAreaWidget::positionHasChanged | ( | ) | [protected, virtual, inherited] |
Reimplemented from KDChart::AbstractAreaBase.
Definition at line 191 of file KDChartAbstractAreaWidget.cpp.
References KDChart::AbstractAreaWidget::positionChanged().
00192 { 00193 emit positionChanged( this ); 00194 }
void KDChart::Legend::propertiesChanged | ( | ) | [signal] |
Emitted upon change of a property of the Legend or any of its components.
const QWidget * Legend::referenceArea | ( | ) | const |
Returns the reference area, that is used for font size of title text, and for font size of the item texts, IF automatic area detection is set.
Definition at line 312 of file KDChartLegend.cpp.
References d.
00313 { 00314 //qDebug() << d->referenceArea; 00315 return (d->referenceArea ? d->referenceArea : static_cast<const QWidget*>(parent())); 00316 }
void Legend::removeDiagram | ( | KDChart::AbstractDiagram * | oldDiagram | ) |
Removes the diagram from the legend's list of diagrams.
Definition at line 367 of file KDChartLegend.cpp.
References d.
Referenced by removeDiagrams(), and replaceDiagram().
00368 { 00369 if( oldDiagram ){ 00370 DiagramObserver* oldObs = d->findObserverForDiagram( oldDiagram ); 00371 if( oldObs ){ 00372 //qDebug() << "before delete oldObs;"; 00373 delete oldObs; 00374 //qDebug() << "after delete oldObs;"; 00375 d->observers.removeAt( d->observers.indexOf( oldObs ) ); 00376 //qDebug() << "after d->observers.removeAt()"; 00377 } 00378 setNeedRebuild(); 00379 } 00380 }
void Legend::removeDiagrams | ( | ) |
Removes all of the diagram from the legend's list of diagrams.
Definition at line 382 of file KDChartLegend.cpp.
References d, and removeDiagram().
00383 { 00384 for (int i = 0; i < d->observers.size(); ++i) 00385 removeDiagram( d->observers.at(i)->diagram() ); 00386 }
void Legend::replaceDiagram | ( | KDChart::AbstractDiagram * | newDiagram, | |
KDChart::AbstractDiagram * | oldDiagram = 0 | |||
) |
Replaces the old diagram, or appends the new diagram, it there is none yet.
newDiagram | The diagram to be used instead of the old one. If this parameter is zero, the first diagram will just be removed. | |
oldDiagram | The diagram to be removed by the new one. This diagram will be deleted automatically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no diagram yet, the new diagram will just be added. |
Definition at line 388 of file KDChartLegend.cpp.
References addDiagram(), d, and removeDiagram().
Referenced by setDiagram().
00390 { 00391 KDChart::AbstractDiagram* old = oldDiagram; 00392 if( ! d->observers.isEmpty() && ! old ){ 00393 old = d->observers.first()->diagram(); 00394 if( ! old ) 00395 d->observers.removeFirst(); // first entry had a 0 diagram 00396 } 00397 if( old ) 00398 removeDiagram( old ); 00399 if( newDiagram ) 00400 addDiagram( newDiagram ); 00401 }
void Legend::resetTexts | ( | ) |
Removes all legend texts that might have been set by setText.
This resets the Legend to default behaviour: Texts are created automatically.
Definition at line 565 of file KDChartLegend.cpp.
References d.
00566 { 00567 if( ! d->texts.count() ) return; 00568 d->texts.clear(); 00569 setNeedRebuild(); 00570 }
void Legend::resizeEvent | ( | QResizeEvent * | event | ) | [virtual] |
Definition at line 824 of file KDChartLegend.cpp.
References forceRebuild(), and sizeHint().
00825 { 00826 Q_UNUSED( event ); 00827 #ifdef DEBUG_LEGEND_PAINT 00828 qDebug() << "Legend::resizeEvent() called"; 00829 #endif 00830 forceRebuild(); 00831 sizeHint(); 00832 QTimer::singleShot(0, this, SLOT(emitPositionChanged())); 00833 }
void Legend::resizeLayout | ( | const QSize & | size | ) | [virtual] |
Reimplemented from KDChart::AbstractAreaWidget.
Definition at line 170 of file KDChartLegend.cpp.
References d.
00171 { 00172 #ifdef DEBUG_LEGEND_PAINT 00173 qDebug() << "Legend::resizeLayout started"; 00174 #endif 00175 if( d->layout ){ 00176 d->layout->setGeometry( QRect(QPoint(0,0), size) ); 00177 activateTheLayout(); 00178 } 00179 #ifdef DEBUG_LEGEND_PAINT 00180 qDebug() << "Legend::resizeLayout done"; 00181 #endif 00182 }
void Legend::setAlignment | ( | Qt::Alignment | alignment | ) |
Specify the alignment of a non-floating legend.
Use setFloatingPosition to set position and alignment if your legend is floating.
Definition at line 468 of file KDChartLegend.cpp.
References d.
Referenced by clone().
00469 { 00470 if( d->alignment == alignment ) 00471 return; 00472 d->alignment = alignment; 00473 emitPositionChanged(); 00474 }
void AbstractAreaBase::setBackgroundAttributes | ( | const BackgroundAttributes & | a | ) | [inherited] |
Definition at line 112 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::positionHasChanged().
00113 { 00114 if( d->backgroundAttributes == a ) 00115 return; 00116 00117 d->backgroundAttributes = a; 00118 positionHasChanged(); 00119 }
void Legend::setBrush | ( | uint | dataset, | |
const QBrush & | brush | |||
) |
void Legend::setBrushesFromDiagram | ( | KDChart::AbstractDiagram * | diagram | ) |
Definition at line 623 of file KDChartLegend.cpp.
References d, and KDChart::AbstractDiagram::datasetBrushes().
00624 { 00625 bool bChangesDone = false; 00626 QList<QBrush> datasetBrushes = diagram->datasetBrushes(); 00627 for( int i = 0; i < datasetBrushes.count(); i++ ){ 00628 if( d->brushes[ i ] != datasetBrushes[ i ] ){ 00629 d->brushes[ i ] = datasetBrushes[ i ]; 00630 bChangesDone = true; 00631 } 00632 } 00633 if( bChangesDone ) { 00634 setNeedRebuild(); 00635 update(); 00636 } 00637 }
void Legend::setColor | ( | uint | dataset, | |
const QColor & | color | |||
) |
Note: there is no color() getter method, since setColor just sets a QBrush with the respective color, so the brush() getter method is sufficient.
Definition at line 593 of file KDChartLegend.cpp.
References d.
Referenced by setDefaultColors(), setRainbowColors(), and setSubduedColors().
00594 { 00595 if( d->brushes[ dataset ] == color ) return; 00596 d->brushes[ dataset ] = color; 00597 setNeedRebuild(); 00598 update(); 00599 }
void Legend::setDatasetHidden | ( | uint | dataset, | |
bool | hidden | |||
) |
void Legend::setDefaultColors | ( | ) |
Definition at line 746 of file KDChartLegend.cpp.
References setColor().
00747 { 00748 setColor( 0, Qt::red ); 00749 setColor( 1, Qt::green ); 00750 setColor( 2, Qt::blue ); 00751 setColor( 3, Qt::cyan ); 00752 setColor( 4, Qt::magenta ); 00753 setColor( 5, Qt::yellow ); 00754 setColor( 6, Qt::darkRed ); 00755 setColor( 7, Qt::darkGreen ); 00756 setColor( 8, Qt::darkBlue ); 00757 setColor( 9, Qt::darkCyan ); 00758 setColor( 10, Qt::darkMagenta ); 00759 setColor( 11, Qt::darkYellow ); 00760 }
void Legend::setDiagram | ( | KDChart::AbstractDiagram * | newDiagram | ) |
A convenience method doing the same as replaceDiagram( newDiagram, 0 );.
Replaces the first diagram by the given diagram. If the legend's list of diagram is empty the given diagram is added to the list.
Definition at line 422 of file KDChartLegend.cpp.
References replaceDiagram().
Referenced by KDChart::Widget::addLegend(), Legend(), KDChart::Widget::replaceLegend(), and KDChart::Widget::setType().
00423 { 00424 replaceDiagram( newDiagram ); 00425 }
void Legend::setFloatingPosition | ( | const RelativePosition & | relativePosition | ) |
Specify the position and alignment of a floating legend.
Use setPosition and setAlignment to set position and alignment if your legend is non-floating.
KDChart::RelativePosition relativePosition; relativePosition.setReferenceArea( m_chart->coordinatePlane() ); relativePosition.setReferencePosition( Position::NorthEast ); relativePosition.setAlignment( Qt::AlignTop | Qt::AlignRight ); relativePosition.setHorizontalPadding( KDChart::Measure( -1.0, KDChartEnums::MeasureCalculationModeAbsolute ) ); relativePosition.setVerticalPadding( KDChart::Measure( 0.0, KDChartEnums::MeasureCalculationModeAbsolute ) ); m_legend->setFloatingPosition( relativePosition );
To have the legend positioned at a fixed point, measured from the QPainter's top left corner, you could use the following code code:
KDChart::RelativePosition relativePosition; relativePosition.setReferencePoints( PositionPoints( QPointF( 0.0, 0.0 ) ) ); relativePosition.setReferencePosition( Position::NorthWest ); relativePosition.setAlignment( Qt::AlignTop | Qt::AlignLeft ); relativePosition.setHorizontalPadding( KDChart::Measure( 4.0, KDChartEnums::MeasureCalculationModeAbsolute ) ); relativePosition.setVerticalPadding( KDChart::Measure( 4.0, KDChartEnums::MeasureCalculationModeAbsolute ) ); m_legend->setFloatingPosition( relativePosition );
Definition at line 494 of file KDChartLegend.cpp.
References d, and KDChart::Position::Floating.
00495 { 00496 d->position = Position::Floating; 00497 if( d->relativePosition != relativePosition ){ 00498 d->relativePosition = relativePosition; 00499 emitPositionChanged(); 00500 } 00501 }
void AbstractAreaBase::setFrameAttributes | ( | const FrameAttributes & | a | ) | [inherited] |
Definition at line 98 of file KDChartAbstractAreaBase.cpp.
References d, and KDChart::AbstractAreaBase::positionHasChanged().
Referenced by clone().
00099 { 00100 if( d->frameAttributes == a ) 00101 return; 00102 00103 d->frameAttributes = a; 00104 positionHasChanged(); 00105 }
void Legend::setHiddenDatasets | ( | const QList< uint > | hiddenDatasets | ) |
Sets a list of datasets that are to be hidden in the legend.
By passing an empty list, you show all datasets. Note that by default, all datasets are shown, which means that hiddenDatasets() == QList<uint>()
Definition at line 1106 of file KDChartLegend.cpp.
References d.
01107 { 01108 d->hiddenDatasets = hiddenDatasets; 01109 }
void Legend::setLegendStyle | ( | LegendStyle | style | ) |
void Legend::setMarkerAttributes | ( | uint | dataset, | |
const MarkerAttributes & | markerAttributes | |||
) |
Note that any sizes specified via setMarkerAttributes are ignored, unless you disable the automatic size calculation, by saying setUseAutomaticMarkerSize( false ).
Definition at line 662 of file KDChartLegend.cpp.
References d.
00663 { 00664 if( d->markerAttributes[dataset] == markerAttributes ) return; 00665 d->markerAttributes[ dataset ] = markerAttributes; 00666 setNeedRebuild(); 00667 update(); 00668 }
void Legend::setOrientation | ( | Qt::Orientation | orientation | ) |
Definition at line 508 of file KDChartLegend.cpp.
References d.
00509 { 00510 if( d->orientation == orientation ) return; 00511 d->orientation = orientation; 00512 setNeedRebuild(); 00513 emitPositionChanged(); 00514 }
void Legend::setPen | ( | uint | dataset, | |
const QPen & | pen | |||
) |
void Legend::setPosition | ( | Position | position | ) |
Specify the position of a non-floating legend.
Use setFloatingPosition to set position and alignment if your legend is floating.
Definition at line 448 of file KDChartLegend.cpp.
References d.
Referenced by KDChart::Widget::addLegend(), and clone().
00449 { 00450 if( d->position == position ) 00451 return; 00452 d->position = position; 00453 emitPositionChanged(); 00454 }
void Legend::setRainbowColors | ( | ) |
Definition at line 762 of file KDChartLegend.cpp.
References brush(), and setColor().
00763 { 00764 setColor( 0, QColor(255, 0,196) ); 00765 setColor( 1, QColor(255, 0, 96) ); 00766 setColor( 2, QColor(255, 128,64) ); 00767 setColor( 3, Qt::yellow ); 00768 setColor( 4, Qt::green ); 00769 setColor( 5, Qt::cyan ); 00770 setColor( 6, QColor( 96, 96,255) ); 00771 setColor( 7, QColor(160, 0,255) ); 00772 for( int i = 8; i < 16; ++i ) 00773 setColor( i, brush( i - 8 ).color().light() ); 00774 }
void Legend::setReferenceArea | ( | const QWidget * | area | ) |
Specifies the reference area for font size of title text, and for font size of the item texts, IF automatic area detection is set.
Definition at line 305 of file KDChartLegend.cpp.
References d.
Referenced by KDChart::Chart::addLegend().
00306 { 00307 if( area == d->referenceArea ) return; 00308 d->referenceArea = area; 00309 setNeedRebuild(); 00310 }
void Legend::setShowLines | ( | bool | legendShowLines | ) |
Definition at line 535 of file KDChartLegend.cpp.
References d.
00536 { 00537 if( d->showLines == legendShowLines ) return; 00538 d->showLines = legendShowLines; 00539 setNeedRebuild(); 00540 emitPositionChanged(); 00541 }
void Legend::setSortOrder | ( | Qt::SortOrder | order | ) |
Definition at line 521 of file KDChartLegend.cpp.
References d.
00522 { 00523 if( d->order == order ) 00524 return; 00525 d->order = order; 00526 setNeedRebuild(); 00527 emitPositionChanged(); 00528 }
void Legend::setSpacing | ( | uint | space | ) |
void Legend::setSubduedColors | ( | bool | ordered = false |
) |
Definition at line 776 of file KDChartLegend.cpp.
References setColor().
00777 { 00778 static const int NUM_SUBDUEDCOLORS = 18; 00779 static const QColor SUBDUEDCOLORS[ NUM_SUBDUEDCOLORS ] = { 00780 QColor( 0xe0,0x7f,0x70 ), 00781 QColor( 0xe2,0xa5,0x6f ), 00782 QColor( 0xe0,0xc9,0x70 ), 00783 QColor( 0xd1,0xe0,0x70 ), 00784 QColor( 0xac,0xe0,0x70 ), 00785 QColor( 0x86,0xe0,0x70 ), 00786 QColor( 0x70,0xe0,0x7f ), 00787 QColor( 0x70,0xe0,0xa4 ), 00788 QColor( 0x70,0xe0,0xc9 ), 00789 QColor( 0x70,0xd1,0xe0 ), 00790 QColor( 0x70,0xac,0xe0 ), 00791 QColor( 0x70,0x86,0xe0 ), 00792 QColor( 0x7f,0x70,0xe0 ), 00793 QColor( 0xa4,0x70,0xe0 ), 00794 QColor( 0xc9,0x70,0xe0 ), 00795 QColor( 0xe0,0x70,0xd1 ), 00796 QColor( 0xe0,0x70,0xac ), 00797 QColor( 0xe0,0x70,0x86 ), 00798 }; 00799 if( ordered ) 00800 for(int i=0; i<NUM_SUBDUEDCOLORS; ++i) 00801 setColor( i, SUBDUEDCOLORS[i] ); 00802 else{ 00803 setColor( 0, SUBDUEDCOLORS[ 0] ); 00804 setColor( 1, SUBDUEDCOLORS[ 5] ); 00805 setColor( 2, SUBDUEDCOLORS[10] ); 00806 setColor( 3, SUBDUEDCOLORS[15] ); 00807 setColor( 4, SUBDUEDCOLORS[ 2] ); 00808 setColor( 5, SUBDUEDCOLORS[ 7] ); 00809 setColor( 6, SUBDUEDCOLORS[12] ); 00810 setColor( 7, SUBDUEDCOLORS[17] ); 00811 setColor( 8, SUBDUEDCOLORS[ 4] ); 00812 setColor( 9, SUBDUEDCOLORS[ 9] ); 00813 setColor(10, SUBDUEDCOLORS[14] ); 00814 setColor(11, SUBDUEDCOLORS[ 1] ); 00815 setColor(12, SUBDUEDCOLORS[ 6] ); 00816 setColor(13, SUBDUEDCOLORS[11] ); 00817 setColor(14, SUBDUEDCOLORS[16] ); 00818 setColor(15, SUBDUEDCOLORS[ 3] ); 00819 setColor(16, SUBDUEDCOLORS[ 8] ); 00820 setColor(17, SUBDUEDCOLORS[13] ); 00821 } 00822 }
void Legend::setText | ( | uint | dataset, | |
const QString & | text | |||
) |
void Legend::setTextAlignment | ( | Qt::Alignment | alignment | ) |
Specify the alignment of the text elements within the legend.
Definition at line 481 of file KDChartLegend.cpp.
References d.
Referenced by clone().
00482 { 00483 if( d->textAlignment == alignment ) 00484 return; 00485 d->textAlignment = alignment; 00486 emitPositionChanged(); 00487 }
void Legend::setTextAttributes | ( | const TextAttributes & | a | ) |
Definition at line 685 of file KDChartLegend.cpp.
References d.
Referenced by KDChart::Chart::addLegend(), and clone().
00686 { 00687 if( d->textAttributes == a ) return; 00688 d->textAttributes = a; 00689 setNeedRebuild(); 00690 }
void Legend::setTitleText | ( | const QString & | text | ) |
void Legend::setTitleTextAttributes | ( | const TextAttributes & | a | ) |
Definition at line 709 of file KDChartLegend.cpp.
References d.
Referenced by KDChart::Chart::addLegend(), and clone().
00710 { 00711 if( d->titleTextAttributes == a ) return; 00712 d->titleTextAttributes = a; 00713 setNeedRebuild(); 00714 }
void Legend::setUseAutomaticMarkerSize | ( | bool | useAutomaticMarkerSize | ) |
This option is on by default, it means that Marker sizes in the Legend will be the same as the font height used for their respective label texts.
Set this to false, if you want to specify the marker sizes via setMarkerAttributes or if you want the Legend to use the same marker sizes as they are used in the Diagrams.
Definition at line 548 of file KDChartLegend.cpp.
References d.
Referenced by clone().
00549 { 00550 d->useAutomaticMarkerSize = useAutomaticMarkerSize; 00551 setNeedRebuild(); 00552 emitPositionChanged(); 00553 }
void Legend::setVisible | ( | bool | visible | ) | [virtual] |
Definition at line 433 of file KDChartLegend.cpp.
Referenced by KDChart::Chart::addLegend(), and KDChart::Chart::takeLegend().
00434 { 00435 if( isVisible() == visible ) 00436 return; 00437 QWidget::setVisible( visible ); 00438 emitPositionChanged(); 00439 }
bool Legend::showLines | ( | ) | const |
Definition at line 543 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00544 { 00545 return d->showLines; 00546 }
QSize Legend::sizeHint | ( | ) | const [virtual] |
Definition at line 152 of file KDChartLegend.cpp.
References d.
Referenced by minimumSizeHint(), KDChart::Chart::reLayoutFloatingLegends(), and resizeEvent().
00153 { 00154 #ifdef DEBUG_LEGEND_PAINT 00155 qDebug() << "Legend::sizeHint() started"; 00156 #endif 00157 Q_FOREACH( KDChart::AbstractLayoutItem* layoutItem, d->layoutItems ) { 00158 layoutItem->sizeHint(); 00159 } 00160 return AbstractAreaWidget::sizeHint(); 00161 }
Qt::SortOrder Legend::sortOrder | ( | ) | const |
Definition at line 530 of file KDChartLegend.cpp.
References d.
00531 { 00532 return d->order; 00533 }
uint Legend::spacing | ( | ) | const |
Definition at line 741 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00742 { 00743 return d->spacing; 00744 }
QString Legend::text | ( | uint | dataset | ) | const |
Qt::Alignment Legend::textAlignment | ( | ) | const |
Returns the alignment used while rendering text elements within the legend.
Definition at line 489 of file KDChartLegend.cpp.
References d.
Referenced by clone(), and compare().
00490 { 00491 return d->textAlignment; 00492 }
TextAttributes Legend::textAttributes | ( | ) | const |
Definition at line 692 of file KDChartLegend.cpp.
References d.
Referenced by KDChart::Chart::addLegend(), clone(), and compare().
00693 { 00694 return d->textAttributes; 00695 }
const QMap< uint, QString > Legend::texts | ( | ) | const |
Definition at line 588 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00589 { 00590 return d->texts; 00591 }
QString Legend::titleText | ( | ) | const |
Definition at line 704 of file KDChartLegend.cpp.
References d.
Referenced by compare().
00705 { 00706 return d->titleText; 00707 }
TextAttributes Legend::titleTextAttributes | ( | ) | const |
Definition at line 716 of file KDChartLegend.cpp.
References d.
Referenced by KDChart::Chart::addLegend(), clone(), and compare().
00717 { 00718 return d->titleTextAttributes; 00719 }
bool Legend::useAutomaticMarkerSize | ( | ) | const |