diff --git a/doc/src/classes.qdoc b/doc/src/classes.qdoc
index 572741a..99a5b57 100644
--- a/doc/src/classes.qdoc
+++ b/doc/src/classes.qdoc
@@ -37,6 +37,11 @@
QCategoryAxis
QDateTimeAxis
QLegend
+ QLegendMarker
+ QPieLegendMarker
+ QXYLegendMarker
+ QBarLegendMarker
+ QAreaLegendMarker
QAbstractSeries
QChartGlobal
diff --git a/src/legend/qarealegendmarker.cpp b/src/legend/qarealegendmarker.cpp
index 03469b4..368f7b5 100644
--- a/src/legend/qarealegendmarker.cpp
+++ b/src/legend/qarealegendmarker.cpp
@@ -25,11 +25,32 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
+/*!
+ \class QAreaLegendMarker
+ \brief QAreaLegendMarker object
+ \mainclass
+
+ QAreaLegendMarker is related to QAreaSeries. One QAreaSeries results in one marker.
+
+ \sa QLegend QAreaSeries
+*/
+
+/*!
+ \fn virtual LegendMarkerType QAreaLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeArea
+*/
+
+/*!
+ Constructor
+*/
QAreaLegendMarker::QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent) :
QLegendMarker(*new QAreaLegendMarkerPrivate(this,series,legend), parent)
{
}
+/*!
+ Destructor
+*/
QAreaLegendMarker::~QAreaLegendMarker()
{
}
@@ -42,6 +63,9 @@ QAreaLegendMarker::QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *paren
{
}
+/*!
+ Returns related series of marker
+*/
QAreaSeries* QAreaLegendMarker::series()
{
Q_D(QAreaLegendMarker);
diff --git a/src/legend/qbarlegendmarker.cpp b/src/legend/qbarlegendmarker.cpp
index ae0f9ec..102b9c6 100644
--- a/src/legend/qbarlegendmarker.cpp
+++ b/src/legend/qbarlegendmarker.cpp
@@ -25,11 +25,32 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
+/*!
+ \class QBarLegendMarker
+ \brief QBarLegendMarker object
+ \mainclass
+
+ QBarLegendMarker is related to QAbstractBarSeries derived classes. With bar series, each marker is related to one QBarSet.
+
+ \sa QLegend QAbstractBarSeries QBarSet
+*/
+
+/*!
+ \fn virtual LegendMarkerType QBarLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeBar
+*/
+
+/*!
+ Constructor
+*/
QBarLegendMarker::QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent) :
QLegendMarker(*new QBarLegendMarkerPrivate(this,series,barset,legend), parent)
{
}
+/*!
+ Desturctor
+*/
QBarLegendMarker::~QBarLegendMarker()
{
}
@@ -42,12 +63,18 @@ QBarLegendMarker::QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent)
{
}
+/*!
+ Returns the related series of marker
+*/
QAbstractBarSeries *QBarLegendMarker::series()
{
Q_D(QBarLegendMarker);
return d->m_series;
}
+/*!
+ Returns the related barset of marker
+*/
QBarSet* QBarLegendMarker::barset()
{
Q_D(QBarLegendMarker);
diff --git a/src/legend/qlegend.cpp b/src/legend/qlegend.cpp
index 00b083e..b7bdace 100644
--- a/src/legend/qlegend.cpp
+++ b/src/legend/qlegend.cpp
@@ -381,6 +381,10 @@ bool QLegend::isBackgroundVisible() const
return d_ptr->m_backgroundVisible;
}
+/*!
+ Returns the list of markers in legend. The list can be filtered with \a series parameter.
+ If \a series is given, only markers related to that series are returned.
+*/
QList QLegend::markers(QAbstractSeries *series) const
{
return d_ptr->markers(series);
diff --git a/src/legend/qlegendmarker.cpp b/src/legend/qlegendmarker.cpp
index 70850f8..06b68ff 100644
--- a/src/legend/qlegendmarker.cpp
+++ b/src/legend/qlegendmarker.cpp
@@ -30,6 +30,54 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
+/*!
+ \class QLegendMarker
+ \brief LegendMarker object
+ \mainclass
+
+ QLegendMarker is abstract object that can be used to access markers inside QLegend. The QLegendMarker is always connected
+ to some series
+
+ \image examples_legendmarkers.png
+
+ \sa QLegend
+*/
+/*!
+ \enum QLegendMarker::LegendMarkerType
+
+ The type of the legendmarker object.
+
+ \value LegendMarkerTypeArea
+ \value LegendMarkerTypeBar
+ \value LegendMarkerTypePie
+ \value LegendMarkerTypeXY
+*/
+
+/*!
+ \fn virtual LegendMarkerType QLegendMarker::type() = 0;
+ Returns the type of legendmarker. Type depends of the related series. LegendMarkerTypeXY is used for all QXYSeries derived
+ classes.
+*/
+
+/*!
+ \fn virtual QAbstractSeries* QLegendMarker::series() = 0;
+ Returns pointer to series, which is related to this marker. Marker is always related to some series.
+*/
+
+/*!
+ \fn void QLegendMarker::clicked();
+ This signal is emitted, when marker is clicked with mouse.
+*/
+
+/*!
+ \fn void QLegendMarker::hovered(bool status);
+ This signal is emitted, when mouse is hovered over marker. \a status is true, when mouse enters the marker
+ and false when it leaves the marker.
+*/
+
+/*!
+ Constructor of marker
+ */
QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) :
QObject(parent),
d_ptr(&d)
@@ -37,65 +85,103 @@ QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) :
d_ptr->m_item->setVisible(d_ptr->series()->isVisible());
}
+/*!
+ Destructor of marker
+*/
QLegendMarker::~QLegendMarker()
{
}
+/*!
+ Returns the label of the marker.
+*/
QString QLegendMarker::label() const
{
return d_ptr->m_item->label();
}
+/*!
+ Sets the \a label of marker. Note that changing name of series will also change label of its marker.
+*/
void QLegendMarker::setLabel(const QString &label)
{
d_ptr->m_item->setLabel(label);
}
-
+/*!
+ Returns the brush which is used to draw label.
+*/
QBrush QLegendMarker::labelBrush() const
{
return d_ptr->m_item->labelBrush();
}
+/*!
+ Sets the \a brush of label
+*/
void QLegendMarker::setLabelBrush(const QBrush &brush)
{
d_ptr->m_item->setLabelBrush(brush);
}
+/*!
+ Retuns the font of label
+*/
QFont QLegendMarker::font() const
{
return d_ptr->m_item->font();
}
+/*!
+ Sets the \a font of label
+*/
void QLegendMarker::setFont(const QFont &font)
{
d_ptr->m_item->setFont(font);
}
+/*!
+ Returns the pen of marker item
+*/
QPen QLegendMarker::pen() const
{
return d_ptr->m_item->pen();
}
+/*!
+ Sets the \a pen of marker item
+*/
void QLegendMarker::setPen(const QPen &pen)
{
d_ptr->m_item->setPen(pen);
}
+/*!
+ Returns the brush of marker item
+*/
QBrush QLegendMarker::brush() const
{
return d_ptr->m_item->brush();
}
+/*!
+ Sets the \a brush of marker item. Note that changing color of the series also changes this.
+*/
void QLegendMarker::setBrush(const QBrush &brush)
{
d_ptr->m_item->setBrush(brush);
}
+/*!
+ Returns visibility of the marker
+*/
bool QLegendMarker::isVisible() const
{
return d_ptr->m_item->isVisible();
}
+/*!
+ Sets markers visibility to \a visible
+*/
void QLegendMarker::setVisible(bool visible)
{
d_ptr->m_item->setVisible(visible);
@@ -107,7 +193,6 @@ QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) :
q_ptr(q)
{
m_item = new LegendMarkerItem(this);
-// m_item->setVisible(q->series()->isVisible());
}
QLegendMarkerPrivate::~QLegendMarkerPrivate()
@@ -119,8 +204,6 @@ void QLegendMarkerPrivate::invalidateLegend()
m_legend->d_ptr->m_layout->invalidate();
}
-
-
#include "moc_qlegendmarker.cpp"
#include "moc_qlegendmarker_p.cpp"
diff --git a/src/legend/qpielegendmarker.cpp b/src/legend/qpielegendmarker.cpp
index 006db7f..9a8adc1 100644
--- a/src/legend/qpielegendmarker.cpp
+++ b/src/legend/qpielegendmarker.cpp
@@ -25,11 +25,32 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
+/*!
+ \class QPieLegendMarker
+ \brief LegendMarker object
+ \mainclass
+
+ QPieLegendMarker is related to QPieSeries. With QPieSeries, each slice of pie is related to one marker in QLegend.
+
+ \sa QLegend QPieSeries QPieSlice
+*/
+
+/*!
+ \fn virtual LegendMarkerType QPieLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypePie
+*/
+
+/*!
+ Constructor
+*/
QPieLegendMarker::QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent) :
QLegendMarker(*new QPieLegendMarkerPrivate(this,series,slice,legend), parent)
{
}
+/*!
+ Destructor
+*/
QPieLegendMarker::~QPieLegendMarker()
{
}
@@ -42,12 +63,18 @@ QPieLegendMarker::QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent)
{
}
+/*!
+ Returns the related series of marker.
+*/
QPieSeries* QPieLegendMarker::series()
{
Q_D(QPieLegendMarker);
return d->m_series;
}
+/*!
+ Returns the related slice of marker.
+*/
QPieSlice* QPieLegendMarker::slice()
{
Q_D(QPieLegendMarker);
diff --git a/src/legend/qxylegendmarker.cpp b/src/legend/qxylegendmarker.cpp
index cb090a7..ebc1d4a 100644
--- a/src/legend/qxylegendmarker.cpp
+++ b/src/legend/qxylegendmarker.cpp
@@ -25,11 +25,32 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
+/*!
+ \class QXYLegendMarker
+ \brief QXYLegendMarker object
+ \mainclass
+
+ QXYLegendMarker is related to QXYSeries derived classes. Each marker is related to one series.
+
+ \sa QLegend QXYSeries QSplineSeries QScatterSeries QLineSeries
+*/
+
+/*!
+ \fn virtual LegendMarkerType QXYLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeXY
+*/
+
+/*!
+ Constructor
+*/
QXYLegendMarker::QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent) :
QLegendMarker(*new QXYLegendMarkerPrivate(this,series,legend), parent)
{
}
+/*!
+ Destructor
+*/
QXYLegendMarker::~QXYLegendMarker()
{
}
@@ -42,6 +63,9 @@ QXYLegendMarker::QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent) :
{
}
+/*!
+ Returns the related series
+*/
QXYSeries* QXYLegendMarker::series()
{
Q_D(QXYLegendMarker);