##// END OF EJS Templates
Bugfixes for layout...
Bugfixes for layout * fix division by zero when delta less then 1 in barcategory axis * fix one frame flash with wrong layout of legend during show event * fix wrong margin size when legend in bottom aligment * adds initlization flag so size hints are always corect * fixes wrong minHeight calcualtion in barcateogry axisY

File last commit:

r1837:21f33dedea6d
r1837:21f33dedea6d
Show More
qlegend.cpp
537 lines | 13.5 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"
Michal Klocek
Refactors layout managment...
r1534 #include "legendlayout_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"
sauimone
renamed barseries files to abstractbarseries
r1586 #include "qabstractbarseries.h"
sauimone
more intelligent legend. fixed compiler warning in bar.cpp
r565 #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>
Michal Klocek
Refactors layout managment...
r1534 #include <QGraphicsLayout>
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
sauimone
legend doc changes
r1501 \brief Legend object
Tero Ahola
Documentation fixes....
r995 \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
*/
Tero Ahola
Adding legend properties
r1452 /*!
\qmlclass Legend QLegend
\brief Legend is part of QtCommercial Chart QML API.
Legend is a graphical object, whics displays legend of the chart. Legend state is updated by ChartView, when
Tero Ahola
Documentation of QML ChartView, Axis and Legend
r1475 series have been changed. Legend is used via ChartView class. For example:
Tero Ahola
Adding legend properties
r1452 \code
ChartView {
legend.visible: true
legend.alignment: Qt.AlignBottom
// Add a few series...
}
\endcode
\image examples_percentbarchart_legend.png
*/
/*!
\property QLegend::alignment
\brief The alignment of the legend.
Legend paints on the defined position in the 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.
*/
/*!
\qmlproperty Qt.Alignment Legend::alignment
\brief The alignment of the legend.
Legend paints on the defined position in the 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.
*/
/*!
\property QLegend::backgroundVisible
Whether the legend background is visible or not.
*/
/*!
\qmlproperty bool Legend::backgroundVisible
Whether the legend background is visible or not.
*/
/*!
\property QLegend::color
Tero Ahola
Fixed setting the legend (background) color
r1472 The color of the legend, i.e. the background (brush) color. Note that if you change the color
of the legend, the style of the legend brush is set to Qt::SolidPattern.
Tero Ahola
Adding legend properties
r1452 */
/*!
\qmlproperty color Legend::color
Tero Ahola
Fixed setting the legend (background) color
r1472 The color of the legend, i.e. the background (brush) color.
Tero Ahola
Adding legend properties
r1452 */
/*!
\property QLegend::borderColor
The border color of the legend, i.e. the line color.
*/
/*!
\qmlproperty color Legend::borderColor
The border color of the legend, i.e. the line color.
*/
sauimone
legend documentation fix. detaching and attaching the legend
r728
sauimone
legend font fix
r1522 /*!
\property QLegend::font
The font of markers used by legend
*/
/*!
\qmlproperty color Legend::font
The font of markers used by legend
*/
Tero Ahola
Documented QLegend label properties
r1529 /*!
\property QLegend::labelColor
The color of brush used to draw labels.
*/
/*!
\qmlproperty color QLegend::labelColor
The color of brush used to draw labels.
*/
Tero Ahola
Adding legend properties
r1452 /*!
\fn void QLegend::backgroundVisibleChanged(bool)
The visibility of the legend background changed to \a visible.
*/
/*!
\fn void QLegend::colorChanged(QColor)
The color of the legend background changed to \a color.
*/
/*!
\fn void QLegend::borderColorChanged(QColor)
The border color of the legend background changed to \a color.
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 */
sauimone
layout fix to legend. Documented legend functions.
r724
sauimone
legend font fix
r1522 /*!
\fn void QLegend::fontChanged(QFont)
The font of markers of the legend changed to \a font.
*/
Tero Ahola
Documented QLegend label properties
r1529 /*!
\fn void QLegend::labelColorChanged(QColor color)
This signal is emitted when the color of brush used to draw labels has changed to \a color.
*/
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
Refactors layout managment...
r1534 setLayout(d_ptr->m_layout);
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 /*!
sauimone
legend doc changes
r1501 \internal
Michal Klocek
Adds qlegend pimpl...
r950 */
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);
sauimone
added roundness to legend background
r1453 painter->drawRoundRect(rect(),d_ptr->roundness(rect().width()),d_ptr->roundness(rect().height()));
sauimone
framework for legend
r524
}
Michal Klocek
Refactors layout managment...
r1534
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();
Tero Ahola
Fixed signaling in QLegend
r1543 emit colorChanged(brush.color());
Michal Klocek
Adds force option to chartTheme...
r645 }
}
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 }
Tero Ahola
Adding legend properties
r1452 void QLegend::setColor(QColor color)
{
QBrush b = d_ptr->m_brush;
Tero Ahola
Fixed setting the legend (background) color
r1472 if (b.style() != Qt::SolidPattern || b.color() != color) {
b.setStyle(Qt::SolidPattern);
Tero Ahola
Adding legend properties
r1452 b.setColor(color);
setBrush(b);
}
}
QColor QLegend::color()
{
return d_ptr->m_brush.color();
}
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();
Tero Ahola
Fixed signaling in QLegend
r1543 emit borderColorChanged(pen.color());
Michal Klocek
Adds force option to chartTheme...
r645 }
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 }
Michal Klocek
Refactors layout managment...
r1534 void QLegend::setFont(const QFont &font)
{
if (d_ptr->m_font != font) {
d_ptr->m_font = font;
foreach (LegendMarker *marker, d_ptr->markers()) {
marker->setFont(d_ptr->m_font);
}
Michal Klocek
Fixes detach legend layout logic
r1536 layout()->invalidate();
Michal Klocek
Refactors layout managment...
r1534 emit fontChanged(font);
}
}
QFont QLegend::font() const
{
return d_ptr->m_font;
}
Tero Ahola
Adding legend properties
r1452 void QLegend::setBorderColor(QColor color)
{
QPen p = d_ptr->m_pen;
if (p.color() != color) {
p.setColor(color);
setPen(p);
}
}
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357
Tero Ahola
Adding legend properties
r1452 QColor QLegend::borderColor()
{
return d_ptr->m_pen.color();
}
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357
Tero Ahola
Documented QLegend label properties
r1529 /*!
Set brush used to draw labels to \a brush.
*/
sauimone
legend theme fix
r1527 void QLegend::setLabelBrush(const QBrush &brush)
{
if (d_ptr->m_labelBrush != brush) {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_labelBrush = brush;
foreach (LegendMarker *marker, d_ptr->markers()) {
marker->setLabelBrush(d_ptr->m_labelBrush);
Tero Ahola
Legend marker rect color now follows the text color
r1795 // Note: The pen of the marker rectangle could be exposed in the public QLegend API
// instead of mapping it from label brush color
marker->setPen(brush.color());
Michal Klocek
Refactors layout managment...
r1534 }
Tero Ahola
Fixed signaling in QLegend
r1543 emit labelColorChanged(brush.color());
sauimone
legend theme fix
r1527 }
}
Tero Ahola
Documented QLegend label properties
r1529 /*!
Brush used to draw labels.
*/
sauimone
legend theme fix
r1527 QBrush QLegend::labelBrush() const
{
return d_ptr->m_labelBrush;
}
void QLegend::setLabelColor(QColor color)
{
QBrush b = d_ptr->m_labelBrush;
if (b.style() != Qt::SolidPattern || b.color() != color) {
b.setStyle(Qt::SolidPattern);
b.setColor(color);
setLabelBrush(b);
}
}
QColor QLegend::labelColor() const
{
return d_ptr->m_labelBrush.color();
}
Michal Klocek
Refactors layout managment...
r1534
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;
Michal Klocek
Refactors layout managment...
r1534 updateGeometry();
if(isAttachedToChart()){
d_ptr->m_presenter->layout()->invalidate();
}else{
layout()->invalidate();
}
Michal Klocek
Refactor qledgend handling...
r855 }
sauimone
Scrolling logic to legend
r716 }
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;
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_layout->invalidate();
setParent(0);
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 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_attachedToChart = true;
d_ptr->m_layout->invalidate();
setParent(d_ptr->m_chart);
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 }
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 {
Tero Ahola
Adding legend properties
r1452 if(d_ptr->m_backgroundVisible != visible) {
d_ptr->m_backgroundVisible = visible;
Michal Klocek
Adds qlegend pimpl...
r950 update();
Tero Ahola
Adding legend properties
r1452 emit backgroundVisibleChanged(visible);
Michal Klocek
Adds qlegend pimpl...
r950 }
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::hideEvent(QHideEvent *event)
sauimone
First version of legend. Simple markers and serie names. Using drilldown as example for now.
r529 {
Michal Klocek
Bugfixes for layout...
r1837 d_ptr->m_presenter->layout()->invalidate();
QGraphicsWidget::hideEvent(event);
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
Bugfixes for layout...
r1837 d_ptr->m_presenter->layout()->invalidate();
QGraphicsWidget::showEvent(event);
Michal Klocek
Adds qlegend pimpl...
r950 }
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),
Michal Klocek
Refactors layout managment...
r1534 m_layout(new LegendLayout(q)),
sauimone
legend example to documentation. minor legend fixes
r1300 m_chart(chart),
Michal Klocek
Refactors layout managment...
r1534 m_items(new QGraphicsItemGroup(q)),
Tero Ahola
Qml ChartView properties; legend to use Qt alignments
r1357 m_alignment(Qt::AlignTop),
Tero Ahola
Fixed decoration of QLegend
r1455 m_brush(QBrush()),
m_pen(QPen()),
sauimone
legend theme fix
r1527 m_labelBrush(QBrush()),
sauimone
added roundness to legend background
r1453 m_diameter(5),
sauimone
legend example to documentation. minor legend fixes
r1300 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 {
Michal Klocek
Refactors layout managment...
r1534 m_layout->setOffset(x,y);
Michal Klocek
Refactor qledgend handling...
r855 }
sauimone
Scrolling logic to legend
r716
sauimone
moved legend offset to private side
r1458 QPointF QLegendPrivate::offset() const
{
Michal Klocek
Refactors layout managment...
r1534 return m_layout->offset();
sauimone
legend example to documentation. minor legend fixes
r1300 }
sauimone
added roundness to legend background
r1453 int QLegendPrivate::roundness(qreal size)
{
return 100*m_diameter/int(size);
}
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);
Michal Klocek
Refactors layout managment...
r1534
sauimone
legend font fix
r1522 foreach(LegendMarker* marker, markers) {
marker->setFont(m_font);
sauimone
legend theme fix
r1527 marker->setLabelBrush(m_labelBrush);
sauimone
fix in legend series visibility handling
r1645 marker->setVisible(series->isVisible());
Michal Klocek
Refactors layout managment...
r1534 m_items->addToGroup(marker);
m_markers<<marker;
sauimone
legend font fix
r1522 }
sauimone
Scrolling logic to legend
r716
sauimone
fix: series visible now affects legend items also
r1459 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
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
Refactors layout managment...
r1534 q_ptr->layout()->invalidate();
Michal Klocek
Fixes blinking and minimal false size for legend
r1538 q_ptr->layout()->activate();
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
Refactors layout managment...
r1534 foreach (LegendMarker *marker, m_markers) {
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 if (marker->series() == series) {
delete marker;
Michal Klocek
Refactors layout managment...
r1534 m_markers.removeAll(marker);
Michal Klocek
Adds trivial legend handling for slices when removed or added
r956 }
}
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
Refactors layout managment...
r1534 q_ptr->layout()->invalidate();
Michal Klocek
Refactor qledgend handling...
r855 }
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
fix: series visible now affects legend items also
r1459 void QLegendPrivate::handleSeriesVisibleChanged()
{
QAbstractSeries* series = qobject_cast<QAbstractSeries *> (sender());
Michal Klocek
Refactors layout managment...
r1534 foreach (LegendMarker* marker, m_markers) {
sauimone
fix: series visible now affects legend items also
r1459 if (marker->series() == series) {
sauimone
fix in legend series visibility handling
r1645 marker->setVisible(series->isVisible());
sauimone
fix: series visible now affects legend items also
r1459 }
}
Michal Klocek
Refactors layout managment...
r1534 q_ptr->layout()->invalidate();
sauimone
fix: series visible now affects legend items also
r1459 }
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