##// END OF EJS Templates
Qml ChartView properties; legend to use Qt alignments
Qml ChartView properties; legend to use Qt alignments

File last commit:

r1357:13ffac597ff0
r1357:13ffac597ff0
Show More
qlegend.cpp
479 lines | 11.9 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
Michal Klocek
Adds qlegend pimpl...
r950 **
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
Jani Honkonen
Add license headers
r794
sauimone
framework for legend
r524 #include "qlegend.h"
Michal Klocek
Adds qlegend pimpl...
r950 #include "qlegend_p.h"
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 #include "qabstractseries.h"
#include "qabstractseries_p.h"
Michal Klocek
Adds qlegend pimpl...
r950 #include "qchart_p.h"
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 #include "legendmarker_p.h"
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 #include "qxyseries.h"
#include "qlineseries.h"
#include "qareaseries.h"
#include "qscatterseries.h"
#include "qsplineseries.h"
#include "qbarseries.h"
#include "qstackedbarseries.h"
#include "qpercentbarseries.h"
#include "qbarset.h"
#include "qpieseries.h"
Jani Honkonen
API review changes for pie
r1009 #include "qpieseries_p.h"
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 #include "qpieslice.h"
sauimone
Adaptive layout to legend. Tries to fit all items inside given maximum size
r626 #include "chartpresenter_p.h"
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529 #include <QPainter>
#include <QPen>
Michal Klocek
Refactor qledgend handling...
r855 #include <QTimer>
sauimone
framework for legend
r524
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 #include <QGraphicsSceneEvent>
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529
sauimone
Separated legend marker to private header. Added signals for left and right mouse click
r547 QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529
sauimone
legend documentation fix. detaching and attaching the legend
r728 /*!
Tero Ahola
Documentation fixes....
r995 \class QLegend
\brief part of QtCommercial chart API.
\mainclass
sauimone
legend documentation fix. detaching and attaching the legend
r728
Tero Ahola
Documentation fixes....
r995 QLegend is a graphical object, whics displays legend of the chart. Legend state is updated by QChart, when
series have been changed. By default, legend is drawn by QChart, but user can set a new parent to legend and
handle the drawing manually.
User isn't supposed to create or delete legend objects, but can reference it via QChart class.
sauimone
legend documentation fix. detaching and attaching the legend
r728
Tero Ahola
Documentation fixes....
r995 \image examples_percentbarchart_legend.png
sauimone
legend documentation fix. detaching and attaching the legend
r728
Tero Ahola
Documentation fixes....
r995 \sa QChart
*/
sauimone
legend documentation fix. detaching and attaching the legend
r728
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 \fn void QLegend::alignmentChanged()
Emitted when the alignment of the legend changes.
*/
sauimone
layout fix to legend. Documented legend functions.
r724
/*!
Michal Klocek
Adds qlegend pimpl...
r950 \fn qreal QLegend::minWidth() const
Returns minimum width of the legend
*/
sauimone
layout fix to legend. Documented legend functions.
r724
/*!
Michal Klocek
Adds qlegend pimpl...
r950 \fn qreal QLegend::minHeight() const
Returns minimum height of the legend
*/
sauimone
layout fix to legend. Documented legend functions.
r724
/*!
Michal Klocek
Adds qlegend pimpl...
r950 Constructs the legend object and sets the parent to \a parent
*/
Michal Klocek
Refactor qledgend handling...
r855
Michal Klocek
Fixes previous commit
r791 QLegend::QLegend(QChart *chart):QGraphicsWidget(chart),
sauimone
legend example to documentation. minor legend fixes
r1300 d_ptr(new QLegendPrivate(chart->d_ptr->m_presenter,chart,this))
sauimone
minor code review fixes
r762 {
sauimone
Adaptive layout to legend. Tries to fit all items inside given maximum size
r626 setZValue(ChartPresenter::LegendZValue);
Michal Klocek
Refactor qledgend handling...
r855 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
Michal Klocek
Fixes normalize signal socekt issue
r1033 QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesAdded(QAbstractSeries*,Domain*)),d_ptr.data(),SLOT(handleSeriesAdded(QAbstractSeries*,Domain*)));
QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesRemoved(QAbstractSeries*)),d_ptr.data(),SLOT(handleSeriesRemoved(QAbstractSeries*)));
sauimone
legend detach example. Bug fixes to legend.
r1263 QObject::connect(chart->d_ptr->m_dataset,SIGNAL(seriesUpdated(QAbstractSeries*)),d_ptr.data(),SLOT(handleSeriesUpdated(QAbstractSeries*)));
Michal Klocek
Adds qlegend pimpl...
r950 }
Tero Ahola
No errors anymore when generating docs, wohoo! For now.
r1002 /*!
Destroys the legend object. Legend is always owned by a QChart, so an application should never call this.
*/
Michal Klocek
Adds qlegend pimpl...
r950 QLegend::~QLegend()
{
sauimone
framework for legend
r524 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Paints the legend to given \a painter. Paremeters \a option and \a widget arent used.
*/
Michal Klocek
Refactor qledgend handling...
r855
sauimone
framework for legend
r524 void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Michal Klocek
Adds qlegend pimpl...
r950 Q_UNUSED(option)
Q_UNUSED(widget)
if(!d_ptr->m_backgroundVisible) return;
Tero Ahola
Squashed bunch of warnings
r611
sauimone
layout fix to legend. Documented legend functions.
r724 painter->setOpacity(opacity());
Michal Klocek
Adds qlegend pimpl...
r950 painter->setPen(d_ptr->m_pen);
painter->setBrush(d_ptr->m_brush);
Michal Klocek
Refactor qledgend handling...
r855 painter->drawRect(boundingRect());
sauimone
framework for legend
r524 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Bounding rect of legend.
*/
Michal Klocek
Refactor qledgend handling...
r855
sauimone
framework for legend
r524 QRectF QLegend::boundingRect() const
{
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_rect;
sauimone
framework for legend
r524 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Sets the \a brush of legend. Brush affects the background of legend.
*/
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 void QLegend::setBrush(const QBrush &brush)
sauimone
background to legend, theme applies
r540 {
Michal Klocek
Adds qlegend pimpl...
r950 if (d_ptr->m_brush != brush) {
d_ptr->m_brush = brush;
Michal Klocek
Adds force option to chartTheme...
r645 update();
}
}
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Returns the brush used by legend.
*/
Michal Klocek
Adds force option to chartTheme...
r645 QBrush QLegend::brush() const
{
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_brush;
Michal Klocek
Adds force option to chartTheme...
r645 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Sets the \a pen of legend. Pen affects the legend borders.
*/
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 void QLegend::setPen(const QPen &pen)
Michal Klocek
Adds force option to chartTheme...
r645 {
Michal Klocek
Adds qlegend pimpl...
r950 if (d_ptr->m_pen != pen) {
d_ptr->m_pen = pen;
Michal Klocek
Adds force option to chartTheme...
r645 update();
}
sauimone
background to legend, theme applies
r540 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Returns the pen used by legend
*/
sauimone
layout fix to legend. Documented legend functions.
r724
Michal Klocek
Adds force option to chartTheme...
r645 QPen QLegend::pen() const
sauimone
background to legend, theme applies
r540 {
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_pen;
sauimone
background to legend, theme applies
r540 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 \property QLegend::alignment
\brief The alignment of the legend.
*/
/*!
Sets the \a alignment for legend. Legend paints on the defined position in chart. The following alignments are
supported: Qt::AlignTop, Qt::AlignBottom, Qt::AlignLeft, Qt::AlignRight. If you set more than one flag the result
is undefined.
\sa QLegend::Alignment
Michal Klocek
Adds qlegend pimpl...
r950 */
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 void QLegend::setAlignment(Qt::Alignment alignment)
sauimone
legend layouting change
r616 {
sauimone
legend detach logic fix
r1281 if(d_ptr->m_alignment!=alignment) {
Michal Klocek
Adds qlegend pimpl...
r950 d_ptr->m_alignment = alignment;
d_ptr->updateLayout();
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 alignmentChanged();
Michal Klocek
Refactor qledgend handling...
r855 }
sauimone
Scrolling logic to legend
r716 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Returns the preferred layout for legend
*/
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 Qt::Alignment QLegend::alignment() const
sauimone
Scrolling logic to legend
r716 {
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_alignment;
sauimone
legend layouting change
r616 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Detaches the legend from chart. Chart won't change layout of the legend.
*/
void QLegend::detachFromChart()
sauimone
framework for legend
r524 {
Michal Klocek
Adds qlegend pimpl...
r950 d_ptr->m_attachedToChart = false;
sauimone
handleThemeChanged slot to legend.
r586 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Attaches the legend to chart. Chart may change layout of the legend.
*/
void QLegend::attachToChart()
sauimone
handleThemeChanged slot to legend.
r586 {
sauimone
legend example to documentation. minor legend fixes
r1300 d_ptr->attachToChart();
sauimone
handleThemeChanged slot to legend.
r586 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 Returns true, if legend is attached to chart.
*/
bool QLegend::isAttachedToChart()
sauimone
Added handling for pieslice add/remove to legend
r637 {
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_attachedToChart;
sauimone
Added handling for pieslice add/remove to legend
r637 }
Tero Ahola
No errors anymore when generating docs, wohoo! For now.
r1002 /*!
Sets the legend's scrolling offset to value defined by \a point.
*/
Michal Klocek
Adds qlegend pimpl...
r950 void QLegend::setOffset(const QPointF& point)
sauimone
fixed bug in legend marker removing
r643 {
Michal Klocek
Adds qlegend pimpl...
r950 d_ptr->setOffset(point.x(),point.y());
sauimone
fixed bug in legend marker removing
r643 }
Tero Ahola
No errors anymore when generating docs, wohoo! For now.
r1002 /*!
Returns the legend's scrolling offset.
*/
Michal Klocek
Adds qlegend pimpl...
r950 QPointF QLegend::offset() const
sauimone
legend layout with padding
r799 {
Michal Klocek
Adds qlegend pimpl...
r950 return QPointF(d_ptr->m_offsetX,d_ptr->m_offsetY);
sauimone
legend layout with padding
r799 }
/*!
Michal Klocek
Adds qlegend pimpl...
r950 Sets the visibility of legend background to \a visible
*/
void QLegend::setBackgroundVisible(bool visible)
sauimone
legend layout with padding
r799 {
Michal Klocek
Adds qlegend pimpl...
r950 if(d_ptr->m_backgroundVisible!=visible)
{
d_ptr->m_backgroundVisible=visible;
update();
}
sauimone
legend layout with padding
r799 }
/*!
Michal Klocek
Adds qlegend pimpl...
r950 Returns the visibility of legend background
*/
bool QLegend::isBackgroundVisible() const
sauimone
legend layout with padding
r799 {
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_backgroundVisible;
sauimone
legend layout with padding
r799 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 \internal \a event see QGraphicsWidget for details
*/
void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event)
sauimone
handleThemeChanged slot to legend.
r586 {
Michal Klocek
Adds qlegend pimpl...
r950 const QRectF& rect = QRectF(QPoint(0,0),event->newSize());
QGraphicsWidget::resizeEvent(event);
if(d_ptr->m_rect != rect) {
d_ptr->m_rect = rect;
d_ptr->updateLayout();
}
sauimone
Legend can handle removing of series
r576 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 \internal \a event see QGraphicsWidget for details
*/
void QLegend::hideEvent(QHideEvent *event)
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529 {
Michal Klocek
Adds qlegend pimpl...
r950 QGraphicsWidget::hideEvent(event);
setEnabled(false);
d_ptr->updateLayout();
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 }
sauimone
layout fix to legend. Documented legend functions.
r724 /*!
Michal Klocek
Adds qlegend pimpl...
r950 \internal \a event see QGraphicsWidget for details
*/
void QLegend::showEvent(QShowEvent *event)
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 {
Michal Klocek
Adds qlegend pimpl...
r950 QGraphicsWidget::showEvent(event);
setEnabled(true);
d_ptr->updateLayout();
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 }
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529
Michal Klocek
Adds qlegend pimpl...
r950 qreal QLegend::minWidth() const
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 {
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_minWidth;
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529 }
Michal Klocek
Adds qlegend pimpl...
r950 qreal QLegend::minHeight() const
sauimone
handleThemeChanged slot to legend.
r586 {
Michal Klocek
Adds qlegend pimpl...
r950 return d_ptr->m_minHeight;
}
Michal Klocek
Refactor qledgend handling...
r855
Michal Klocek
Adds qlegend pimpl...
r950 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
legend example to documentation. minor legend fixes
r1300 QLegendPrivate::QLegendPrivate(ChartPresenter* presenter, QChart *chart, QLegend *q):
q_ptr(q),
m_presenter(presenter),
m_chart(chart),
m_markers(new QGraphicsItemGroup(q)),
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 m_alignment(Qt::AlignTop),
sauimone
legend example to documentation. minor legend fixes
r1300 m_offsetX(0),
m_offsetY(0),
m_minWidth(0),
m_minHeight(0),
m_width(0),
m_height(0),
m_attachedToChart(true),
m_backgroundVisible(false)
Michal Klocek
Adds qlegend pimpl...
r950 {
Michal Klocek
Refactor qledgend handling...
r855
sauimone
handleThemeChanged slot to legend.
r586 }
Michal Klocek
Adds qlegend pimpl...
r950 QLegendPrivate::~QLegendPrivate()
{
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529
Michal Klocek
Adds qlegend pimpl...
r950 }
void QLegendPrivate::setOffset(qreal x, qreal y)
Michal Klocek
Refactor qledgend handling...
r855 {
sauimone
Adaptive layout to legend. Tries to fit all items inside given maximum size
r626
Michal Klocek
Refactor qledgend handling...
r855 switch(m_alignment) {
sauimone
Scrolling logic to legend
r716
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 case Qt::AlignTop:
case Qt::AlignBottom: {
Michal Klocek
Refactor qledgend handling...
r855 if(m_width<=m_rect.width()) return;
sauimone
split legend layout to vertical and horizontal functions
r810
Michal Klocek
Adds qlegend pimpl...
r950 if (x != m_offsetX) {
Michal Klocek
Krazy reported errors...
r974 m_offsetX = qBound(qreal(0), x, m_width - m_rect.width());
Michal Klocek
Refactor qledgend handling...
r855 m_markers->setPos(-m_offsetX,m_rect.top());
sauimone
Adaptive layout to legend. Tries to fit all items inside given maximum size
r626 }
Michal Klocek
Refactor qledgend handling...
r855 break;
sauimone
legend layouting change
r616 }
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 case Qt::AlignLeft:
case Qt::AlignRight: {
sauimone
Scrolling logic to legend
r716
Michal Klocek
Refactor qledgend handling...
r855 if(m_height<=m_rect.height()) return;
sauimone
Scrolling logic to legend
r716
Michal Klocek
Adds qlegend pimpl...
r950 if (y != m_offsetY) {
Michal Klocek
Krazy reported errors...
r974 m_offsetY = qBound(qreal(0), y, m_height - m_rect.height());
Michal Klocek
Refactor qledgend handling...
r855 m_markers->setPos(m_rect.left(),-m_offsetY);
sauimone
Scrolling logic to legend
r716 }
Michal Klocek
Refactor qledgend handling...
r855 break;
sauimone
Scrolling logic to legend
r716 }
sauimone
split legend layout to vertical and horizontal functions
r810 }
Michal Klocek
Refactor qledgend handling...
r855 }
sauimone
Scrolling logic to legend
r716
Michal Klocek
Adds qlegend pimpl...
r950 void QLegendPrivate::updateLayout()
sauimone
Scrolling logic to legend
r716 {
Michal Klocek
Adds qlegend pimpl...
r950 m_offsetX=0;
Michal Klocek
Refactor qledgend handling...
r855 QList<QGraphicsItem *> items = m_markers->childItems();
if(items.isEmpty()) return;
m_minWidth=0;
m_minHeight=0;
switch(m_alignment) {
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 case Qt::AlignTop:
case Qt::AlignBottom: {
Michal Klocek
Refactor qledgend handling...
r855 QPointF point = m_rect.topLeft();
m_width = 0;
foreach (QGraphicsItem *item, items) {
item->setPos(point.x(),m_rect.height()/2 -item->boundingRect().height()/2);
const QRectF& rect = item->boundingRect();
qreal w = rect.width();
m_minWidth=qMax(m_minWidth,w);
m_minHeight=qMax(m_minHeight,rect.height());
m_width+=w;
point.setX(point.x() + w);
}
Michal Klocek
Adds qlegend pimpl...
r950 if(m_width<m_rect.width()) {
Michal Klocek
Refactor qledgend handling...
r855 m_markers->setPos(m_rect.width()/2-m_width/2,m_rect.top());
Michal Klocek
Adds qlegend pimpl...
r950 }
else {
Michal Klocek
Refactor qledgend handling...
r855 m_markers->setPos(m_rect.topLeft());
}
m_height=m_minHeight;
}
break;
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 case Qt::AlignLeft:
case Qt::AlignRight: {
Michal Klocek
Refactor qledgend handling...
r855 QPointF point = m_rect.topLeft();
m_height = 0;
foreach (QGraphicsItem *item, items) {
item->setPos(point);
const QRectF& rect = item->boundingRect();
qreal h = rect.height();
m_minWidth=qMax(m_minWidth,rect.width());
m_minHeight=qMax(m_minHeight,h);
m_height+=h;
point.setY(point.y() + h);
}
Michal Klocek
Adds qlegend pimpl...
r950 if(m_height<m_rect.height()) {
Michal Klocek
Refactor qledgend handling...
r855 m_markers->setPos(m_rect.left(),m_rect.height()/2-m_height/2);
Michal Klocek
Adds qlegend pimpl...
r950 }
else {
Michal Klocek
Refactor qledgend handling...
r855 m_markers->setPos(m_rect.topLeft());
}
m_width=m_minWidth;
}
break;
}
sauimone
Scrolling logic to legend
r716
sauimone
legend detach logic fix
r1281 if (m_attachedToChart) {
m_presenter->updateLayout();
}
sauimone
Scrolling logic to legend
r716 }
sauimone
legend example to documentation. minor legend fixes
r1300 void QLegendPrivate::attachToChart()
{
m_attachedToChart = true;
q_ptr->setParent(m_chart);
}
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain)
Michal Klocek
Refactor qledgend handling...
r855 {
Michal Klocek
Adds qlegend pimpl...
r950 Q_UNUSED(domain)
sauimone
Scrolling logic to legend
r716
Michal Klocek
Adds qlegend pimpl...
r950 QList<LegendMarker*> markers = series->d_ptr->createLegendMarker(q_ptr);
Tero Ahola
Fixed a bug with legend not updating series labels
r1328 foreach(LegendMarker* marker, markers)
Michal Klocek
Adds qlegend pimpl...
r950 m_markers->addToGroup(marker);
sauimone
Scrolling logic to legend
r716
Tero Ahola
Fixed a bug with legend not updating series labels
r1328 if(series->type() == QAbstractSeries::SeriesTypePie) {
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 QPieSeries *pieSeries = static_cast<QPieSeries *>(series);
Jani Honkonen
pie: make slice added/removed signals public (again)
r1213 QObject::connect(pieSeries, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries()));
QObject::connect(pieSeries, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries()));
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 }
Michal Klocek
Refactor qledgend handling...
r855 updateLayout();
sauimone
Scrolling logic to legend
r716 }
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series)
sauimone
Scrolling logic to legend
r716 {
Michal Klocek
Adds qlegend pimpl...
r950 QList<QGraphicsItem *> items = m_markers->childItems();
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 foreach (QGraphicsItem *markers, items) {
LegendMarker *marker = static_cast<LegendMarker*>(markers);
if (marker->series() == series) {
delete marker;
}
}
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 if(series->type() == QAbstractSeries::SeriesTypePie)
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 {
QPieSeries *pieSeries = static_cast<QPieSeries *>(series);
Jani Honkonen
pie: make slice added/removed signals public (again)
r1213 QObject::disconnect(pieSeries, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries()));
QObject::disconnect(pieSeries, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleUpdatePieSeries()));
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 }
Michal Klocek
Adds qlegend pimpl...
r950
Michal Klocek
Refactor qledgend handling...
r855 updateLayout();
}
sauimone
layout fix to legend. Documented legend functions.
r724
sauimone
legend detach example. Bug fixes to legend.
r1263 void QLegendPrivate::handleSeriesUpdated(QAbstractSeries *series)
{
// TODO: find out which markers are are added or removed. Update them
// TODO: better implementation
handleSeriesRemoved(series);
Domain domain;
handleSeriesAdded(series, &domain);
}
Jani Honkonen
API review changes for pie
r1009 void QLegendPrivate::handleUpdatePieSeries()
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 {
//TODO: reimplement to be optimal
Jani Honkonen
pie: make slice added/removed signals public (again)
r1213 QPieSeries* series = qobject_cast<QPieSeries *> (sender());
Q_ASSERT(series);
handleSeriesRemoved(series);
handleSeriesAdded(series, 0);
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 }
sauimone
framework for legend
r524 #include "moc_qlegend.cpp"
Michal Klocek
Adds qlegend pimpl...
r950 #include "moc_qlegend_p.cpp"
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737
sauimone
framework for legend
r524 QTCOMMERCIALCHART_END_NAMESPACE