##// END OF EJS Templates
Add Polar chart support...
Add Polar chart support This commit also heavily refactors things as polar chart needs separate implementation of various classes that previously only needed one, such as ChartAxis and ChartLayout. Task-number: QTRD-1757 Change-Id: I3d3db23920314987ceef3ae92879960b833b7136 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2432:53927f716a3d
r2483:f494279b6366
Show More
qpielegendmarker.cpp
143 lines | 3.6 KiB | text/x-c | CppLexer
/ src / legend / qpielegendmarker.cpp
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 /****************************************************************************
**
Miikka Heikkinen
Fixed the copyright year 2012 -> 2013
r2432 ** Copyright (C) 2013 Digia Plc
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 ** 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$
**
****************************************************************************/
#include "qpielegendmarker.h"
sauimone
QPieLegenmarkerPrivate added
r2166 #include "qpielegendmarker_p.h"
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 #include <QPieSeries>
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174 #include <QPieSlice>
sauimone
new legend example for testing new api. Currently using still the old one.
r2162
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
layout work started
r2168
sauimone
documentation of legendmarkers
r2216 /*!
\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
*/
/*!
Tero Ahola
Fixed several documentation issues
r2265 \internal
sauimone
documentation of legendmarkers
r2216 */
sauimone
optional series parameter to markers function. code style fixes
r2193 QPieLegendMarker::QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent) :
sauimone
removing old commented code. removing domain parameter from handleseriesadded of pimpl. adding QLegend parameter to marker construction
r2171 QLegendMarker(*new QPieLegendMarkerPrivate(this,series,slice,legend), parent)
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 {
sauimone
fixed crash in legendmarker when calling update from private constructor
r2227 d_ptr->updated();
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 }
sauimone
documentation of legendmarkers
r2216 /*!
Destructor
*/
sauimone
layout work started
r2168 QPieLegendMarker::~QPieLegendMarker()
sauimone
refactoring
r2167 {
}
/*!
\internal
*/
QPieLegendMarker::QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent) :
QLegendMarker(d, parent)
sauimone
added LegendMarkerItem. Updated new legend example to test clicked of LegendMarker
r2164 {
}
sauimone
documentation of legendmarkers
r2216 /*!
Returns the related series of marker.
*/
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174 QPieSeries* QPieLegendMarker::series()
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 {
sauimone
refactoring
r2167 Q_D(QPieLegendMarker);
return d->m_series;
}
sauimone
documentation of legendmarkers
r2216 /*!
Returns the related slice of marker.
*/
sauimone
removed peer object solution. Introduced marker type solution
r2179 QPieSlice* QPieLegendMarker::slice()
sauimone
refactoring
r2167 {
Q_D(QPieLegendMarker);
return d->m_slice;
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 }
sauimone
new legend example for testing new api. Currently using still the old one.
r2162
sauimone
QPieLegenmarkerPrivate added
r2166 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
removing old commented code. removing domain parameter from handleseriesadded of pimpl. adding QLegend parameter to marker construction
r2171 QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend) :
QLegendMarkerPrivate(q,legend),
sauimone
fixed crash in legendmarker when calling update from private constructor
r2227 q_ptr(q),
sauimone
refactoring
r2167 m_series(series),
m_slice(slice)
sauimone
QPieLegenmarkerPrivate added
r2166 {
sauimone
layout work started
r2168 QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated()));
QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated()));
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174 QObject::connect(m_slice, SIGNAL(penChanged()), this, SLOT(updated()));
sauimone
QPieLegenmarkerPrivate added
r2166 }
QPieLegendMarkerPrivate::~QPieLegendMarkerPrivate()
{
}
sauimone
Better handling for new or removed markers
r2182 QPieSeries* QPieLegendMarkerPrivate::series()
{
return m_series;
}
QObject* QPieLegendMarkerPrivate::relatedObject()
{
return m_slice;
}
sauimone
refactoring
r2167 void QPieLegendMarkerPrivate::updated()
{
sauimone
signals for properties in legendmarker
r2225 bool labelChanged = false;
bool brushChanged = false;
bool penChanged = false;
Mika Salmela
Fix for not overriding user settings for legend markers....
r2429 if (!m_customPen && (m_item->pen() != m_slice->pen())) {
sauimone
signals for properties in legendmarker
r2225 m_item->setPen(m_slice->pen());
penChanged = true;
}
Mika Salmela
Fix for not overriding user settings for legend markers....
r2429 if (!m_customBrush && (m_item->brush() != m_slice->brush())) {
sauimone
signals for properties in legendmarker
r2225 m_item->setBrush(m_slice->brush());
brushChanged = true;
}
Mika Salmela
Fix for not overriding user settings for legend markers....
r2429 if (!m_customLabel && (m_item->label() != m_slice->label())) {
sauimone
signals for properties in legendmarker
r2225 m_item->setLabel(m_slice->label());
labelChanged = true;
}
sauimone
fix to QTRD-1674: layout is not calculated correctly after the change in the text of legend marker
r2194 invalidateLegend();
sauimone
signals for properties in legendmarker
r2225
if (labelChanged)
emit q_ptr->labelChanged();
if (brushChanged)
emit q_ptr->brushChanged();
if (penChanged)
emit q_ptr->penChanged();
sauimone
refactoring
r2167 }
sauimone
new legend example for testing new api. Currently using still the old one.
r2162 #include "moc_qpielegendmarker.cpp"
sauimone
QPieLegenmarkerPrivate added
r2166 #include "moc_qpielegendmarker_p.cpp"
sauimone
new legend example for testing new api. Currently using still the old one.
r2162
QTCOMMERCIALCHART_END_NAMESPACE