9#include "KChartLegend.h"
10#include "KChartLegend_p.h"
11#include <KChartTextAttributes.h>
12#include <KChartMarkerAttributes.h>
13#include <KChartPalette.h>
14#include <KChartAbstractDiagram.h>
15#include "KTextDocument.h"
16#include <KChartDiagramObserver.h>
17#include "KChartLayoutItems.h"
18#include "KChartPrintingParameters.h"
23#include <QTextTableCell>
25#include <QTextCharFormat>
26#include <QTextDocumentFragment>
28#include <QAbstractTextDocumentLayout>
34Legend::Private::Private() :
35 referenceArea( nullptr ),
43 titleText(
QObject::tr(
"Legend" ) ),
45 useAutomaticMarkerSize( true ),
46 legendStyle( MarkersOnly )
51 relativePosition.setReferencePosition( Position::NorthWest );
53 relativePosition.setHorizontalPadding(
Measure( 4.0, KChartEnums::MeasureCalculationModeAbsolute ) );
54 relativePosition.setVerticalPadding(
Measure( 4.0, KChartEnums::MeasureCalculationModeAbsolute ) );
57Legend::Private::~Private()
66Legend::Legend(
QWidget* parent ) :
69 d->referenceArea = parent;
76 d->referenceArea = parent;
78 setDiagram( diagram );
83 Q_EMIT destroyedLegend(
this );
91 d->layout->setContentsMargins( 2, 2, 2, 2 );
92 d->layout->setSpacing( d->spacing );
94 const Measure normalFontSizeTitle( 12, KChartEnums::MeasureCalculationModeAbsolute );
95 const Measure normalFontSizeLabels( 10, KChartEnums::MeasureCalculationModeAbsolute );
96 const Measure minimalFontSize( 4, KChartEnums::MeasureCalculationModeAbsolute );
103 setTextAttributes( textAttrs );
110 setTitleTextAttributes( titleTextAttrs );
113 frameAttrs.setVisible(
true );
115 frameAttrs.setPadding( 1 );
116 setFrameAttributes( frameAttrs );
118 d->position = Position::NorthEast;
123QSize Legend::minimumSizeHint()
const
130QSize Legend::sizeHint()
const
132#ifdef DEBUG_LEGEND_PAINT
133 qDebug() <<
"Legend::sizeHint() started";
138 return AbstractAreaWidget::sizeHint();
141void Legend::needSizeHint()
146void Legend::resizeLayout(
const QSize& size )
148#ifdef DEBUG_LEGEND_PAINT
149 qDebug() <<
"Legend::resizeLayout started";
152 d->reflowHDatasetItems(
this );
153 d->layout->setGeometry(
QRect(
QPoint( 0,0 ), size) );
156#ifdef DEBUG_LEGEND_PAINT
157 qDebug() <<
"Legend::resizeLayout done";
161void Legend::activateTheLayout()
163 if ( d->layout && d->layout->parent() ) {
164 d->layout->activate();
168void Legend::setLegendStyle( LegendStyle style )
170 if ( d->legendStyle == style ) {
173 d->legendStyle = style;
177Legend::LegendStyle Legend::legendStyle()
const
179 return d->legendStyle;
184 Legend* legend =
new Legend(
new Private( *d ),
nullptr );
185 legend->setTextAttributes( textAttributes() );
186 legend->setTitleTextAttributes( titleTextAttributes() );
187 legend->setFrameAttributes( frameAttributes() );
192 legend->setLegendStyle( legendStyle() );
197bool Legend::compare(
const Legend* other )
const
199 if ( other ==
this ) {
208 (position() == other->
position()) &&
212 (orientation() == other->orientation())&&
213 (showLines() == other->showLines())&&
214 (texts() == other->texts())&&
215 (brushes() == other->brushes())&&
216 (pens() == other->pens())&&
217 (markerAttributes() == other->markerAttributes())&&
218 (useAutomaticMarkerSize() == other->useAutomaticMarkerSize()) &&
219 (textAttributes() == other->textAttributes()) &&
220 (titleText() == other->titleText())&&
221 (titleTextAttributes() == other->titleTextAttributes()) &&
222 (spacing() == other->spacing()) &&
223 (legendStyle() == other->legendStyle());
229#ifdef DEBUG_LEGEND_PAINT
230 qDebug() <<
"entering Legend::paint( QPainter* painter )";
239 paintItem->paint( painter );
242#ifdef DEBUG_LEGEND_PAINT
243 qDebug() <<
"leaving Legend::paint( QPainter* painter )";
256 const QRect oldGeometry(geometry() );
258 if (oldGeometry != newGeo) {
263 paintAll( *painter );
266 if (oldGeometry != newGeo) {
267 setGeometry(oldGeometry);
272uint Legend::datasetCount()
const
274 int modelLabelsCount = 0;
280 return modelLabelsCount;
284void Legend::setReferenceArea(
const QWidget* area )
286 if ( area == d->referenceArea ) {
289 d->referenceArea = area;
295 return d->referenceArea ? d->referenceArea : qobject_cast< const QWidget* >( parent() );
301 if ( d->observers.isEmpty() ) {
304 return d->observers.first()->diagram();
310 for (
int i = 0; i < d->observers.size(); ++i ) {
311 list << d->observers.at(i)->diagram();
319 for (
int i = 0; i < d->observers.size(); ++i ) {
320 list << d->observers.at(i)->diagram();
333 d->observers[ d->observers.indexOf( oldObs ) ] = observer;
335 d->observers.append( observer );
340 SLOT(setNeedRebuild()));
342 SLOT(setNeedRebuild()));
344 SLOT(setNeedRebuild()));
351 int datasetBrushOffset = 0;
353 for (
int i = 0; i <diagrams.
count(); i++ ) {
354 if ( diagrams.
at( i ) == oldDiagram ) {
355 for (
int i = 0; i < oldDiagram->
datasetBrushes().count(); i++ ) {
356 d->brushes.remove(datasetBrushOffset + i);
357 d->texts.remove(datasetBrushOffset + i);
359 for (
int i = 0; i < oldDiagram->
datasetPens().count(); i++ ) {
360 d->pens.remove(datasetBrushOffset + i);
364 datasetBrushOffset += diagrams.
at(i)->datasetBrushes().count();
371 d->observers.removeAt( d->observers.indexOf( oldObs ) );
377void Legend::removeDiagrams()
382 for (
int i = 0; i < d->observers.size(); ++i ) {
383 diagrams.
append( d->observers.at( i )->diagram() );
385 for (
int i = 0; i < diagrams.
count(); ++i ) {
386 removeDiagram( diagrams[ i ] );
394 if ( !d->observers.isEmpty() && !old ) {
395 old = d->observers.first()->diagram();
397 d->observers.removeFirst();
401 removeDiagram( old );
404 addDiagram( newDiagram );
412 for (
int i = 0; i < d->observers.count(); ++i ) {
413 if ( d->observers.at(i)->diagram() == diagram ) {
417 if ( !diagram->
model() ) {
428 replaceDiagram( newDiagram );
433 removeDiagram( oldDiagram );
436void Legend::setVisible(
bool visible )
441 emitPositionChanged();
444void Legend::setNeedRebuild()
452 if ( d->position == position ) {
455 d->position = position;
456 emitPositionChanged();
459void Legend::emitPositionChanged()
461 Q_EMIT positionChanged(
this );
462 Q_EMIT propertiesChanged();
473 if ( d->alignment == alignment ) {
476 d->alignment = alignment;
477 emitPositionChanged();
487 if ( d->textAlignment == alignment ) {
490 d->textAlignment = alignment;
491 emitPositionChanged();
496 return d->textAlignment;
501 if ( d->legendLineSymbolAlignment == alignment ) {
504 d->legendLineSymbolAlignment = alignment;
505 emitPositionChanged();
510 return d->legendLineSymbolAlignment ;
515 d->position = Position::Floating;
516 if ( d->relativePosition != relativePosition ) {
517 d->relativePosition = relativePosition;
518 emitPositionChanged();
524 return d->relativePosition;
529 if ( d->orientation == orientation ) {
532 d->orientation = orientation;
534 emitPositionChanged();
539 return d->orientation;
544 if ( d->order == order ) {
549 emitPositionChanged();
557void Legend::setShowLines(
bool legendShowLines )
559 if ( d->showLines == legendShowLines ) {
562 d->showLines = legendShowLines;
564 emitPositionChanged();
567bool Legend::showLines()
const
572void Legend::setUseAutomaticMarkerSize(
bool useAutomaticMarkerSize )
574 d->useAutomaticMarkerSize = useAutomaticMarkerSize;
576 emitPositionChanged();
579bool Legend::useAutomaticMarkerSize()
const
581 return d->useAutomaticMarkerSize;
584void Legend::resetTexts()
586 if ( !d->texts.count() ) {
593void Legend::setText( uint dataset,
const QString& text )
595 if ( d->texts[ dataset ] == text ) {
598 d->texts[ dataset ] = text;
602QString Legend::text( uint dataset )
const
604 if ( d->texts.find( dataset ) != d->texts.end() ) {
605 return d->texts[ dataset ];
607 return d->modelLabels[ dataset ];
616void Legend::setColor( uint dataset,
const QColor& color )
618 if ( d->brushes[ dataset ] != color ) {
619 d->brushes[ dataset ] = color;
625void Legend::setBrush( uint dataset,
const QBrush& brush )
627 if ( d->brushes[ dataset ] != brush ) {
628 d->brushes[ dataset ] = brush;
634QBrush Legend::brush( uint dataset )
const
636 if ( d->brushes.contains( dataset ) ) {
637 return d->brushes[ dataset ];
639 return d->modelBrushes[ dataset ];
651 bool changed =
false;
653 for (
int i = 0; i < datasetBrushes.
count(); i++ ) {
654 if ( d->brushes[ i ] != datasetBrushes[ i ] ) {
655 d->brushes[ i ] = datasetBrushes[ i ];
666void Legend::setPen( uint dataset,
const QPen& pen )
668 if ( d->pens[dataset] == pen ) {
671 d->pens[dataset] = pen;
676QPen Legend::pen( uint dataset )
const
678 if ( d->pens.find( dataset ) != d->pens.end() ) {
679 return d->pens[ dataset ];
681 return d->modelPens[ dataset ];
693 if ( d->markerAttributes[dataset] == markerAttributes ) {
696 d->markerAttributes[ dataset ] = markerAttributes;
703 if ( d->markerAttributes.find( dataset ) != d->markerAttributes.end() ) {
704 return d->markerAttributes[ dataset ];
705 }
else if (
static_cast<uint
>( d->modelMarkers.count() ) > dataset ) {
706 return d->modelMarkers[ dataset ];
714 return d->markerAttributes;
720 if ( d->textAttributes == a ) {
723 d->textAttributes = a;
729 return d->textAttributes;
732void Legend::setTitleText(
const QString& text )
734 if ( d->titleText == text ) {
741QString Legend::titleText()
const
748 if ( d->titleTextAttributes == a ) {
751 d->titleTextAttributes = a;
757 return d->titleTextAttributes;
760void Legend::forceRebuild()
762#ifdef DEBUG_LEGEND_PAINT
763 qDebug() <<
"entering Legend::forceRebuild()";
766#ifdef DEBUG_LEGEND_PAINT
767 qDebug() <<
"leaving Legend::forceRebuild()";
771void Legend::setSpacing( uint space )
773 if ( d->spacing == space && d->layout->spacing() ==
int( space ) ) {
777 d->layout->setSpacing( space );
781uint Legend::spacing()
const
786void Legend::setDefaultColors()
788 Palette pal = Palette::defaultPalette();
789 for (
int i = 0; i < pal.size(); i++ ) {
790 setBrush( i, pal.getBrush( i ) );
794void Legend::setRainbowColors()
796 Palette pal = Palette::rainbowPalette();
797 for (
int i = 0; i < pal.size(); i++ ) {
798 setBrush( i, pal.getBrush( i ) );
802void Legend::setSubduedColors(
bool ordered )
804 Palette pal = Palette::subduedPalette();
806 for (
int i = 0; i < pal.size(); i++ ) {
807 setBrush( i, pal.getBrush( i ) );
810 static const int s_subduedColorsCount = 18;
811 Q_ASSERT( pal.size() >= s_subduedColorsCount );
812 static const int order[ s_subduedColorsCount ] = {
813 0, 5, 10, 15, 2, 7, 12, 17, 4,
814 9, 14, 1, 6, 11, 16, 3, 8, 13
816 for (
int i = 0; i < s_subduedColorsCount; i++ ) {
817 setBrush( i, pal.getBrush( order[i] ) );
825#ifdef DEBUG_LEGEND_PAINT
826 qDebug() <<
"Legend::resizeEvent() called";
833void Legend::Private::fetchPaintOptions(
Legend *q )
836 modelBrushes.clear();
838 modelMarkers.clear();
840 for (
int i = 0; i < observers.size(); ++i ) {
851 int dataset = ascend ? 0 : diagramLabels.
count() - 1;
852 const int end = ascend ? diagramLabels.
count() : -1;
853 for ( ; dataset !=
end; dataset += ascend ? 1 : -1 ) {
854 if ( diagram->
isHidden( dataset ) || q->datasetIsHidden( dataset ) ) {
857 modelLabels += diagramLabels[ dataset ];
858 modelBrushes += diagramBrushes[ dataset ];
859 modelPens += diagramPens[ dataset ];
860 modelMarkers += diagramMarkers[ dataset ];
864 Q_ASSERT( modelLabels.count() == modelBrushes.count() );
867QSizeF Legend::Private::markerSize(
Legend *q,
int dataset, qreal fontHeight )
const
869 QSizeF suppliedSize = q->markerAttributes( dataset ).markerSize();
870 if ( q->useAutomaticMarkerSize() || !suppliedSize.
isValid() ) {
871 return QSizeF( fontHeight, fontHeight );
877QSizeF Legend::Private::maxMarkerSize(
Legend *q, qreal fontHeight )
const
880 if ( q->legendStyle() != LinesOnly ) {
881 for (
int dataset = 0; dataset < modelLabels.count(); ++dataset ) {
882 ret = ret.expandedTo( markerSize( q, dataset, fontHeight ) );
888HDatasetItem::HDatasetItem()
889 : markerLine(nullptr),
891 separatorLine(nullptr),
895static void updateToplevelLayout(
QWidget *w)
905 w = qobject_cast< QWidget * >( w->
parent() );
911void Legend::buildLegend()
918 d->destroyOldLayout();
921 d->layout->setColumnStretch( 6, 1 );
923 d->layout->setColumnStretch( 6, 0 );
926 d->fetchPaintOptions(
this );
929 orientation() ==
Qt::Vertical ? KChartEnums::MeasureOrientationMinimum
930 : KChartEnums::MeasureOrientationHorizontal;
933 if ( !titleText().isEmpty() && titleTextAttributes().
isVisible() ) {
936 measureOrientation, d->textAlignment );
939 d->paintItems << titleItem;
943 if ( showLines() && d->modelLabels.count() ) {
945 d->paintItems << lineItem;
961 const QSizeF maxMarkerSize = d->maxMarkerSize(
this, fontHeight );
968 const int lineLengthLeftOfMarker = 8;
970 int maxLineLength = 18;
972 bool hasComplexPenStyle =
false;
973 for (
int dataset = 0; dataset < d->modelLabels.count(); ++dataset ) {
974 const QPen pn = pen( dataset );
977 maxLineLength = qMin( pn.
width() * 18, maxLineLength );
979 hasComplexPenStyle =
true;
983 if ( legendStyle() != LinesOnly ) {
984 if ( hasComplexPenStyle )
985 maxLineLength += lineLengthLeftOfMarker;
986 maxLineLength += int( maxMarkerSize.
width() );
992 for (
int dataset = 0; dataset < d->modelLabels.count(); ++dataset ) {
993 const int vLayoutRow = 2 + dataset * 2;
999 markerAttrs.
setMarkerSize( d->markerSize(
this, dataset, fontHeight ) );
1000 const QBrush markerBrush = markerAttrs.markerColor().
isValid() ?
1001 QBrush( markerAttrs.markerColor() ) : brush( dataset );
1003 switch ( legendStyle() ) {
1012 case MarkersAndLines:
1014 diagram(), maxLineLength, pen( dataset ), lineLengthLeftOfMarker, markerAttrs,
1022 measureOrientation, d->textAlignment );
1023 dsItem.label->setParentWidget(
this );
1028 d->hLayoutDatasets << dsItem;
1033 if ( dsItem.markerLine ) {
1034 d->layout->addItem( dsItem.markerLine, vLayoutRow, 1, 1, 1,
Qt::AlignCenter );
1035 d->paintItems << dsItem.markerLine;
1038 d->paintItems << dsItem.label;
1041 if ( showLines() && dataset != d->modelLabels.count() - 1 ) {
1043 d->layout->addItem( lineItem, vLayoutRow + 1, 0, 1, 5,
Qt::AlignCenter );
1044 d->paintItems << lineItem;
1049 d->flowHDatasetItems(
this );
1053 if ( orientation() ==
Qt::Vertical && showLines() && d->modelLabels.count() ) {
1055 d->paintItems << lineItem;
1056 d->layout->addItem( lineItem, 2, 2, d->modelLabels.count() * 2, 1 );
1059 updateToplevelLayout(
this );
1062#ifdef DEBUG_LEGEND_PAINT
1063 qDebug() <<
"leaving Legend::buildLegend()";
1067int HDatasetItem::height()
const
1069 return qMax( markerLine->sizeHint().height(),
label->sizeHint().height() );
1072void Legend::Private::reflowHDatasetItems(
Legend *q )
1074 if (hLayoutDatasets.isEmpty()) {
1081 for (
int i = layout->count() - 1; i >= 0; i-- ) {
1087 paintItems << alItem;
1090 Q_ASSERT(
dynamic_cast< QHBoxLayout *
>( hbox ) );
1091 layout->takeAt( i );
1093 for (
int j = hbox->
count() - 1; j >= 0; j-- ) {
1099 flowHDatasetItems( q );
1104void Legend::Private::flowHDatasetItems(
Legend *q )
1106 const int separatorLineWidth = 3;
1108 const int allowedWidth = q->areaGeometry().width();
1111 int mainLayoutColumn = 0;
1113 if ( !titleText.isEmpty() && titleTextAttributes.isVisible() ) {
1115 if (q->showLines()){
1119 layout->
addItem( currentLine, row, mainLayoutColumn,
1121 mainLayoutColumn += columnSpan;
1123 for (
int dataset = 0; dataset < hLayoutDatasets.size(); dataset++ ) {
1124 HDatasetItem *hdsItem = &hLayoutDatasets[ dataset ];
1126 bool spacerUsed =
false;
1127 bool separatorUsed =
false;
1128 if ( !currentLine->
isEmpty() ) {
1129 const int separatorWidth = ( q->showLines() ? separatorLineWidth : 0 ) + q->spacing();
1130 const int payloadWidth = hdsItem->markerLine->sizeHint().width() +
1131 hdsItem->label->sizeHint().width();
1132 if ( currentLine->
sizeHint().
width() + separatorWidth + payloadWidth > allowedWidth ) {
1134#ifdef DEBUG_LEGEND_PAINT
1135 qDebug() << Q_FUNC_INFO <<
"break" << mainLayoutColumn
1137 << currentLine->
sizeHint().
width() + separatorWidth + payloadWidth
1141 layout->
addItem( currentLine, row, mainLayoutColumn,
1143 mainLayoutColumn += columnSpan;
1146 if ( !hdsItem->spacer ) {
1147 hdsItem->spacer =
new QSpacerItem( q->spacing(), 1 );
1149 currentLine->
addItem( hdsItem->spacer );
1152 if ( q->showLines() ) {
1153 if ( !hdsItem->separatorLine ) {
1156 paintItems << hdsItem->separatorLine;
1157 currentLine->
addItem( hdsItem->separatorLine );
1158 separatorUsed =
true;
1163 if ( !spacerUsed ) {
1164 delete hdsItem->spacer;
1165 hdsItem->spacer =
nullptr;
1167 if ( !separatorUsed ) {
1168 delete hdsItem->separatorLine;
1169 hdsItem->separatorLine =
nullptr;
1172 currentLine->
addItem( hdsItem->markerLine );
1173 paintItems << hdsItem->markerLine;
1174 currentLine->
addItem( hdsItem->label );
1175 paintItems << hdsItem->label;
1179bool Legend::hasHeightForWidth()
const
1184 return !d->hLayoutDatasets.isEmpty();
1187int Legend::heightForWidth(
int width )
const
1189 if ( d->hLayoutDatasets.isEmpty() ) {
1195 for (
int i = 0; i < 2; i++) {
1196 if (
QLayoutItem *item = d->layout->itemAtPosition( i, 0 ) ) {
1200 const int separatorLineWidth = 3;
1202 int currentLineWidth = 0;
1203 int currentLineHeight = 0;
1204 for (
const HDatasetItem &hdsItem : d->hLayoutDatasets ) {
1205 const int payloadWidth = hdsItem.markerLine->sizeHint().width() +
1206 hdsItem.label->sizeHint().width();
1207 if ( !currentLineWidth ) {
1209 currentLineWidth = payloadWidth;
1211 const int separatorWidth = ( showLines() ? separatorLineWidth : 0 ) + spacing();
1212 currentLineWidth += separatorWidth + payloadWidth;
1213 if ( currentLineWidth >
width ) {
1215#ifdef DEBUG_LEGEND_PAINT
1216 qDebug() << Q_FUNC_INFO <<
"heightForWidth break" << currentLineWidth
1217 << currentLineWidth + separatorWidth + payloadWidth
1220 ret += currentLineHeight + spacing();
1221 currentLineWidth = payloadWidth;
1222 currentLineHeight = 0;
1225 currentLineHeight = qMax( currentLineHeight, hdsItem.height() );
1227 ret += currentLineHeight;
1231void Legend::Private::destroyOldLayout()
1235 for (
int i = layout->count() - 1; i >= 0; i-- ) {
1236 delete layout->takeAt( i );
1238 Q_ASSERT( !layout->count() );
1239 hLayoutDatasets.clear();
1245 d->hiddenDatasets = hiddenDatasets;
1250 return d->hiddenDatasets;
1253void Legend::setDatasetHidden( uint dataset,
bool hidden )
1255 if ( hidden && !d->hiddenDatasets.contains( dataset ) ) {
1256 d->hiddenDatasets.append( dataset );
1257 }
else if ( !hidden && d->hiddenDatasets.contains( dataset ) ) {
1258 d->hiddenDatasets.removeAll( dataset );
1262bool Legend::datasetIsHidden( uint dataset )
const
1264 return d->hiddenDatasets.contains( dataset );
MeasureOrientation
Measure orientation mode: the way how the absolute value of a KChart::Measure is determined during KC...
bool compare(const AbstractAreaBase *other) const
Returns true if both areas have the same settings.
AbstractDiagram defines the interface for diagram classes.
QStringList datasetLabels() const
The set of dataset labels currently displayed, for use in legends, etc.
QList< QBrush > datasetBrushes() const
The set of dataset brushes currently used, for use in legends, etc.
QList< QPen > datasetPens() const
The set of dataset pens currently used, for use in legends, etc.
QList< MarkerAttributes > datasetMarkers() const
The set of dataset markers currently used, for use in legends, etc.
bool isHidden() const
Retrieve the hidden status specified globally.
Base class for all layout items of KChart.
virtual void setParentWidget(QWidget *widget)
Inform the item about its widget: This enables the item, to trigger that widget's update,...
A DiagramObserver watches the associated diagram for changes and deletion and emits corresponding sig...
A set of attributes for frames around items.
static QPaintDevice * paintDevice()
Return the paint device to use for calculating font metrics.
static void setPaintDevice(QPaintDevice *paintDevice)
Set the paint device to use for calculating font metrics.
Layout item showing a horizontal line.
Legend defines the interface for the legend drawing class.
const RelativePosition floatingPosition() const
Returns the position of a floating legend.
Qt::Alignment textAlignment() const
Returns the alignment used while rendering text elements within the legend.
void setHiddenDatasets(const QList< uint > hiddenDatasets)
Sets a list of datasets that are to be hidden in the legend.
void setPosition(Position position)
Specify the position of a non-floating legend.
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 h...
void propertiesChanged()
Emitted upon change of a property of the Legend or any of its components.
Qt::Alignment alignment() const
Returns the alignment 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 t...
void setTextAlignment(Qt::Alignment)
Specify the alignment of the text elements within the legend.
KChart::AbstractDiagram * diagram() const
The first diagram of the legend or 0 if there was none added to the legend.
Position position() const
Returns the position of a non-floating legend.
void setAlignment(Qt::Alignment)
Specify the alignment of a non-floating legend.
Layout item showing a coloured line.
Layout item showing a coloured line and a data point marker.
A set of attributes controlling the appearance of data set markers.
void setMarkerSize(const QSizeF &size)
Normally you need to specify a valid QSizeF here, but for Legends you can use the invalid size QSizeF...
Layout item showing a data point marker.
Measure is used to specify relative and absolute sizes in KChart, e.g.
Stores the absolute target points of a Position.
Defines a position, using compass terminology.
Defines relative position information: reference area, position in this area (reference position),...
A set of text attributes.
void setFontSize(const Measure &measure)
Set the size of the font used for rendering text.
void setMinimalFontSize(const Measure &measure)
Set the minimal size of the font used for rendering text.
qreal calculatedFontSize(const QSizeF &referenceSize, KChartEnums::MeasureOrientation autoReferenceOrientation) const
Returns the font size that is used at drawing time.
void setPen(const QPen &pen)
Set the pen to use for rendering the text.
void setFont(const QFont &font)
Set the font to be used for rendering the text.
Layout item showing a text.
Layout item showing a vertical line.
void update(Part *part, const QByteArray &data, qint64 dataSize)
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
QString label(StandardShortcut id)
virtual int columnCount(const QModelIndex &parent) const const=0
QAbstractItemModel * model() const const
virtual void addItem(QLayoutItem *item) override
virtual QSize sizeHint() const const override
bool isValid() const const
void setPointSizeF(qreal pointSize)
qreal height() const const
virtual int count() const const=0
virtual bool isEmpty() const const override
virtual QLayoutItem * takeAt(int index)=0
virtual QLayout * layout()
virtual QSize sizeHint() const const=0
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
qsizetype count() const const
QObject * parent() const const
QPaintDevice * device() const const
void translate(const QPoint &offset)
Qt::PenStyle style() const const
bool isEmpty() const const
bool isValid() const const
qreal width() const const