##// END OF EJS Templates
Fix label angle setting for axis before axis is added to chart....
Fix label angle setting for axis before axis is added to chart. Since slots are obviously not connected before ChartAxis item is created, setting label angle before this is lost unless set in the constructor.

File last commit:

r2277:3866e510c514
r2410:47bf654423ee
Show More
qpieseries.cpp
925 lines | 22.3 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** 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
Pie chart refactoring
r142 #include "qpieseries.h"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "qpieseries_p.h"
Jani Honkonen
Refactoring QPieSlice private implementation. Removes the useless QPieSlicePrivate layer and uses PieSliceData directly.
r818 #include "qpieslice.h"
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 #include "qpieslice_p.h"
Jani Honkonen
Refactoring QPieSlice private implementation. Removes the useless QPieSlicePrivate layer and uses PieSliceData directly.
r818 #include "pieslicedata_p.h"
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 #include "chartdataset_p.h"
#include "charttheme_p.h"
sauimone
added createAxis methods to private series
r1545 #include "qabstractaxis.h"
Michal Klocek
Refactor animator...
r1735 #include "pieanimation_p.h"
Jani Honkonen
Pie chart refactoring
r142
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 #include "qpielegendmarker.h"
Jani Honkonen
Pie chart refactoring
r142 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Jani Honkonen
More documentation for pie
r320 /*!
\class QPieSeries
\brief Pie series API for QtCommercial Charts
Jani Honkonen
Pie doc updates
r952 The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects.
Jani Honkonen
More documentation for pie
r320 The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices.
Jani Honkonen
Review corrections for pie
r386 The actual slice size is determined by that relative value.
Jani Honkonen
More documentation for pie
r320
Jani Honkonen
Pie doc updates
r952 Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0
These relate to the actual chart rectangle.
By default the pie is defined as a full pie but it can also be a partial pie.
Jani Honkonen
More documentation for pie
r320 This can be done by setting a starting angle and angle span to the series.
Jani Honkonen
Pie doc updates
r952 Full pie is 360 degrees where 0 is at 12 a'clock.
Tero Ahola
Documentation fixes....
r995
Marek Rosa
Added simple donut chart example docs
r1842 See the \l {PieChart Example} {pie chart example} or \l {DonutChart Example} {donut chart example} to learn how to use QPieSeries.
\table 100%
\row
\o \image examples_piechart.png
\o \image examples_donut.png
\endtable
Jani Honkonen
More documentation for pie
r320 */
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlclass PieSeries QPieSeries
Tero Ahola
QML methods of series: several fixes and documentation
r1521 \inherits AbstractSeries
Tero Ahola
Documenting xy-series
r1491
The following QML shows how to create a simple pie chart.
Jani Honkonen
Add pieseries qml doc
r1504
Tero Ahola
Documenting xy-series
r1491 \snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1
Jani Honkonen
Add pieseries qml doc
r1504
Tero Ahola
Documenting xy-series
r1491 \beginfloatleft
\image demos_qmlchart1.png
\endfloat
\clearfloat
*/
Jani Honkonen
More documentation for pie
r320
Marek Rosa
Some more doc fixes and additions
r924 /*!
Jani Honkonen
fix QPieSeries property docs
r928 \property QPieSeries::horizontalPosition
Jani Honkonen
Update pie docs
r932 \brief Defines the horizontal position of the pie.
Jani Honkonen
Add pieseries qml doc
r1504
Jani Honkonen
Update pie docs
r932 The value is a relative value to the chart rectangle where:
Jani Honkonen
Add pieseries qml doc
r1504
Jani Honkonen
Update pie docs
r932 \list
\o 0.0 is the absolute left.
\o 1.0 is the absolute right.
\endlist
Default value is 0.5 (center).
Tero Ahola
Documenting xy-series
r1491 \sa verticalPosition
*/
Jani Honkonen
Add pieseries qml doc
r1504
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlproperty real PieSeries::horizontalPosition
Jani Honkonen
Add pieseries qml doc
r1504
Defines the horizontal position of the pie.
The value is a relative value to the chart rectangle where:
Tero Ahola
Documenting xy-series
r1491 \list
\o 0.0 is the absolute left.
\o 1.0 is the absolute right.
\endlist
Default value is 0.5 (center).
Jani Honkonen
pieseries: update docs
r1279 \sa verticalPosition
*/
Jani Honkonen
fix QPieSeries property docs
r928 /*!
\property QPieSeries::verticalPosition
Jani Honkonen
Update pie docs
r932 \brief Defines the vertical position of the pie.
Jani Honkonen
Add pieseries qml doc
r1504
Jani Honkonen
Update pie docs
r932 The value is a relative value to the chart rectangle where:
Jani Honkonen
Add pieseries qml doc
r1504
Jani Honkonen
Update pie docs
r932 \list
\o 0.0 is the absolute top.
\o 1.0 is the absolute bottom.
\endlist
Default value is 0.5 (center).
Tero Ahola
Documenting xy-series
r1491 \sa horizontalPosition
*/
Jani Honkonen
Add pieseries qml doc
r1504
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlproperty real PieSeries::verticalPosition
Jani Honkonen
Add pieseries qml doc
r1504
Defines the vertical position of the pie.
The value is a relative value to the chart rectangle where:
Tero Ahola
Documenting xy-series
r1491 \list
\o 0.0 is the absolute top.
\o 1.0 is the absolute bottom.
\endlist
Default value is 0.5 (center).
Jani Honkonen
pieseries: update docs
r1279 \sa horizontalPosition
*/
Jani Honkonen
fix QPieSeries property docs
r928 /*!
\property QPieSeries::size
Jani Honkonen
Update pie docs
r932 \brief Defines the pie size.
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Update pie docs
r932 The value is a relative value to the chart rectangle where:
\list
Michal Klocek
Krazy reported errors...
r974 \o 0.0 is the minimum size (pie not drawn).
Jani Honkonen
Update pie docs
r932 \o 1.0 is the maximum size that can fit the chart.
\endlist
Marek Rosa
Donut support simplified. Examples updated
r1838 When setting this property the holeSize property is adjusted if necessary, to ensure that the hole size is not greater than the outer size.
Marek Rosa
Inner pie (donut) size cannot be smaller than the outer pie size
r1741
Jani Honkonen
Update pie docs
r932 Default value is 0.7.
Jani Honkonen
fix QPieSeries property docs
r928 */
Jani Honkonen
Add pieseries qml doc
r1504 /*!
\qmlproperty real PieSeries::size
Defines the pie size.
The value is a relative value to the chart rectangle where:
\list
\o 0.0 is the minimum size (pie not drawn).
\o 1.0 is the maximum size that can fit the chart.
\endlist
Default value is 0.7.
*/
Marek Rosa
Docs update
r1731 /*!
Marek Rosa
Donut support simplified. Examples updated
r1838 \property QPieSeries::holeSize
\brief Defines the donut hole size.
Marek Rosa
Docs update
r1731
The value is a relative value to the chart rectangle where:
\list
Marek Rosa
Donut support simplified. Examples updated
r1838 \o 0.0 is the minimum size (full pie drawn, without any hole inside).
Marek Rosa
Docs update
r1731 \o 1.0 is the maximum size that can fit the chart. (donut has no width)
\endlist
The value is never greater then size property.
Marek Rosa
Donut support simplified. Examples updated
r1838 Default value is 0.0.
Marek Rosa
Docs update
r1731 */
/*!
Marek Rosa
Donut support simplified. Examples updated
r1838 \qmlproperty real PieSeries::holeSize
Marek Rosa
Docs update
r1731
Marek Rosa
Donut support simplified. Examples updated
r1838 Defines the donut hole size.
Marek Rosa
Docs update
r1731
The value is a relative value to the chart rectangle where:
\list
Marek Rosa
Donut support simplified. Examples updated
r1838 \o 0.0 is the minimum size (full pie drawn, without any hole inside).
Marek Rosa
Docs update
r1731 \o 1.0 is the maximum size that can fit the chart. (donut has no width)
\endlist
Marek Rosa
Inner pie (donut) size cannot be smaller than the outer pie size
r1741 When setting this property the size property is adjusted if necessary, to ensure that the inner size is not greater than the outer size.
Marek Rosa
Donut support simplified. Examples updated
r1838 Default value is 0.0.
Marek Rosa
Docs update
r1731 */
Jani Honkonen
fix QPieSeries property docs
r928 /*!
\property QPieSeries::startAngle
Jani Honkonen
Update pie docs
r932 \brief Defines the starting angle of the pie.
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Update pie docs
r932 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Update pie docs
r932 Default is value is 0.
*/
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Add pieseries qml doc
r1504 /*!
\qmlproperty real PieSeries::startAngle
Defines the starting angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Default is value is 0.
*/
Jani Honkonen
fix QPieSeries property docs
r928 /*!
\property QPieSeries::endAngle
Jani Honkonen
Update pie docs
r932 \brief Defines the ending angle of the pie.
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Update pie docs
r932 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Update pie docs
r932 Default is value is 360.
*/
Jani Honkonen
fix QPieSeries property docs
r928
Jani Honkonen
Add pieseries qml doc
r1504 /*!
\qmlproperty real PieSeries::endAngle
Defines the ending angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Default is value is 360.
*/
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 /*!
\property QPieSeries::count
Jani Honkonen
pieseries: update docs
r1279 Number of slices in the series.
*/
Jani Honkonen
Add pieseries qml doc
r1504 /*!
\qmlproperty int PieSeries::count
Number of slices in the series.
*/
Jani Honkonen
pieseries: update docs
r1279 /*!
\fn void QPieSeries::countChanged()
Emitted when the slice count has changed.
\sa count
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 */
Tero Ahola
QML signals documentation
r1531 /*!
\qmlsignal PieSeries::onCountChanged()
Emitted when the slice count has changed.
*/
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224
/*!
\property QPieSeries::sum
Jani Honkonen
pieseries: update docs
r1279
Sum of all slices.
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224
The series keeps track of the sum of all slices it holds.
*/
Jani Honkonen
Add pieseries qml doc
r1504 /*!
\qmlproperty real PieSeries::sum
Sum of all slices.
The series keeps track of the sum of all slices it holds.
*/
Jani Honkonen
pieseries: update docs
r1279 /*!
\fn void QPieSeries::sumChanged()
Emitted when the sum of all slices has changed.
\sa sum
*/
Tero Ahola
QML signals documentation
r1531 /*!
\qmlsignal PieSeries::onSumChanged()
Emitted when the sum of all slices has changed. This may happen for example if you add or remove slices, or if you
change value of a slice.
*/
Jani Honkonen
pieseries: update docs
r1279
/*!
\fn void QPieSeries::added(QList<QPieSlice*> slices)
This signal is emitted when \a slices have been added to the series.
\sa append(), insert()
*/
Tero Ahola
QML api pie slice added/removed signals
r1503 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSeries::onAdded(PieSlice slice)
Tero Ahola
QML api pie slice added/removed signals
r1503 Emitted when \a slice has been added to the series.
*/
Jani Honkonen
pieseries: update docs
r1279
/*!
\fn void QPieSeries::removed(QList<QPieSlice*> slices)
This signal is emitted when \a slices have been removed from the series.
\sa remove()
*/
Tero Ahola
QML api pie slice added/removed signals
r1503 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSeries::onRemoved(PieSlice slice)
Tero Ahola
QML api pie slice added/removed signals
r1503 Emitted when \a slice has been removed from the series.
*/
Jani Honkonen
pieseries: update docs
r1279
/*!
\fn void QPieSeries::clicked(QPieSlice* slice)
This signal is emitted when a \a slice has been clicked.
\sa QPieSlice::clicked()
*/
Tero Ahola
QML signals documentation
r1531 /*!
\qmlsignal PieSeries::onClicked(PieSlice slice)
This signal is emitted when a \a slice has been clicked.
*/
Jani Honkonen
pieseries: update docs
r1279
/*!
\fn void QPieSeries::hovered(QPieSlice* slice, bool state)
This signal is emitted when user has hovered over or away from the \a slice.
\a state is true when user has hovered over the slice and false when hover has moved away from the slice.
\sa QPieSlice::hovered()
*/
Tero Ahola
QML signals documentation
r1531 /*!
\qmlsignal PieSeries::onHovered(PieSlice slice, bool state)
This signal is emitted when user has hovered over or away from the \a slice. \a state is true when user has hovered
over the slice and false when hover has moved away from the slice.
*/
Marek Rosa
Some more doc fixes and additions
r924
Tero Ahola
QML methods of series: several fixes and documentation
r1521 /*!
\qmlmethod PieSlice PieSeries::at(int index)
Returns slice at \a index. Returns null if the index is not valid.
*/
/*!
\qmlmethod PieSlice PieSeries::find(string label)
Returns the first slice with \a label. Returns null if the index is not valid.
*/
/*!
\qmlmethod PieSlice PieSeries::append(string label, real value)
Adds a new slice with \a label and \a value to the pie.
*/
/*!
\qmlmethod bool PieSeries::remove(PieSlice slice)
Jani Honkonen
Fix some spelling errors
r1932 Removes the \a slice from the pie. Returns true if the removal was successful, false otherwise.
Tero Ahola
QML methods of series: several fixes and documentation
r1521 */
/*!
\qmlmethod PieSeries::clear()
Removes all slices from the pie.
*/
Jani Honkonen
Add documentation to pie
r314 /*!
Constructs a series object which is a child of \a parent.
*/
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 QPieSeries::QPieSeries(QObject *parent)
: QAbstractSeries(*new QPieSeriesPrivate(this), parent)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Michal Klocek
Fixes legend markers updates
r2085 Q_D(QPieSeries);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 QObject::connect(this, SIGNAL(countChanged()), d, SIGNAL(countChanged()));
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
Refactoring piechart API (and internals)
r174
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
Minor qpieseries doc updates.
r933 Destroys the series and its slices.
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 QPieSeries::~QPieSeries()
{
Jani Honkonen
Adding PIMPL to pie
r669 // NOTE: d_prt destroyed by QObject
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
More documentation for pie
r320 Returns QChartSeries::SeriesTypePie.
Jani Honkonen
Add documentation to pie
r314 */
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 QAbstractSeries::SeriesType QPieSeries::type() const
Jani Honkonen
Add documentation to pie
r314 {
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 return QAbstractSeries::SeriesTypePie;
Jani Honkonen
Add documentation to pie
r314 }
Jani Honkonen
pieseries: update docs
r1279 /*!
Appends a single \a slice to the series.
Slice ownership is passed to the series.
Returns true if append was succesfull.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QPieSeries::append(QPieSlice *slice)
Jani Honkonen
pieseries: update docs
r1279 {
Jani Honkonen
more coding style fixes for src-folder...
r2104 return append(QList<QPieSlice *>() << slice);
Jani Honkonen
pieseries: update docs
r1279 }
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
Minor qpieseries doc updates.
r933 Appends an array of \a slices to the series.
Jani Honkonen
Add documentation to pie
r314 Slice ownership is passed to the series.
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224
Jani Honkonen
Fix some spelling errors
r1932 Returns true if append was successful.
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QPieSeries::append(QList<QPieSlice *> slices)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104 if (slices.count() == 0)
return false;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, slices) {
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104 if (!s || d->m_slices.contains(s))
return false;
Jani Honkonen
pie: prevent adding same slice to two series
r1324 if (s->series()) // already added to some series
return false;
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, slices) {
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 s->setParent(this);
Jani Honkonen
Add QPieSlice::series() and tests
r1323 QPieSlicePrivate::fromSlice(s)->m_series = this;
Jani Honkonen
Adding PIMPL to pie
r669 d->m_slices << s;
Jani Honkonen
Refactoring piechart API (and internals)
r174 }
Jani Honkonen
Use signals from pieseries, visible hover and exploding slices
r157
Jani Honkonen
Adding PIMPL to pie
r669 d->updateDerivativeData();
Jani Honkonen
Refactoring piechart API (and internals)
r174
Jani Honkonen
src folder: another massive victory for coding style police
r2131 foreach(QPieSlice * s, slices) {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 connect(s, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
Jani Honkonen
API review changes for pie
r1009 connect(s, SIGNAL(clicked()), d, SLOT(sliceClicked()));
connect(s, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
pie: make slice added/removed signals public (again)
r1213 emit added(slices);
Jani Honkonen
pie: add everything as a property in series...
r1255 emit countChanged();
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104
return true;
Jani Honkonen
Pie chart refactoring
r142 }
Jani Honkonen
Update pie series doc
r415 /*!
Jani Honkonen
Minor qpieseries doc updates.
r933 Appends a single \a slice to the series and returns a reference to the series.
Jani Honkonen
Update pie series doc
r415 Slice ownership is passed to the series.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 QPieSeries &QPieSeries::operator << (QPieSlice *slice)
Jani Honkonen
Add drilldown example for piechart
r406 {
Jani Honkonen
rename functions add() -> append()
r796 append(slice);
Jani Honkonen
Add drilldown example for piechart
r406 return *this;
}
Jani Honkonen
Add documentation to pie
r314
/*!
Jani Honkonen
pie: change the order of parameters when creating slices to be more intuitive
r1206 Appends a single slice to the series with give \a value and \a label.
Jani Honkonen
Add documentation to pie
r314 Slice ownership is passed to the series.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 QPieSlice *QPieSeries::append(QString label, qreal value)
Jani Honkonen
Pie chart refactoring
r142 {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QPieSlice *slice = new QPieSlice(label, value);
Jani Honkonen
rename functions add() -> append()
r796 append(slice);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 return slice;
}
Jani Honkonen
Refactoring piechart API (and internals)
r174
Jani Honkonen
Doc fixes for pie
r809 /*!
Inserts a single \a slice to the series before the slice at \a index position.
Slice ownership is passed to the series.
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224
Jani Honkonen
Fix some spelling errors
r1932 Returns true if insert was successful.
Jani Honkonen
Doc fixes for pie
r809 */
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QPieSeries::insert(int index, QPieSlice *slice)
Marek Rosa
Added insert pie slice function to QPieSeries
r604 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104
if (index < 0 || index > d->m_slices.count())
return false;
if (!slice || d->m_slices.contains(slice))
return false;
Jani Honkonen
pie: prevent adding same slice to two series
r1324 if (slice->series()) // already added to some series
return false;
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 slice->setParent(this);
Jani Honkonen
Add QPieSlice::series() and tests
r1323 QPieSlicePrivate::fromSlice(slice)->m_series = this;
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 d->m_slices.insert(index, slice);
Marek Rosa
Pie now has defualt Model to which slice data is copied.
r1195
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 d->updateDerivativeData();
Marek Rosa
Added insert pie slice function to QPieSeries
r604
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 connect(slice, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 connect(slice, SIGNAL(clicked()), d, SLOT(sliceClicked()));
connect(slice, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
Marek Rosa
Added insert pie slice function to QPieSeries
r604
Jani Honkonen
more coding style fixes for src-folder...
r2104 emit added(QList<QPieSlice *>() << slice);
Jani Honkonen
pie: add everything as a property in series...
r1255 emit countChanged();
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104
return true;
Marek Rosa
Added insert pie slice function to QPieSeries
r604 }
Jani Honkonen
Add documentation to pie
r314 /*!
Removes a single \a slice from the series and deletes the slice.
Jani Honkonen
More documentation for pie
r320
Jani Honkonen
Pie doc updates
r952 Do not reference the pointer after this call.
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224
Jani Honkonen
Fix some spelling errors
r1932 Returns true if remove was successful.
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QPieSeries::remove(QPieSlice *slice)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104
if (!d->m_slices.removeOne(slice))
return false;
Jani Honkonen
Refactoring piechart API (and internals)
r174
Jani Honkonen
Adding PIMPL to pie
r669 d->updateDerivativeData();
Jani Honkonen
Refactoring piechart API (and internals)
r174
Jani Honkonen
more coding style fixes for src-folder...
r2104 emit removed(QList<QPieSlice *>() << slice);
Jani Honkonen
pie: add everything as a property in series...
r1255 emit countChanged();
Jani Honkonen
Refactoring pie series and animations.
r621
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 delete slice;
Jani Honkonen
NULL -> 0
r823 slice = 0;
Jani Honkonen
pieseries: bool return value for append/insert/remove...
r1104
return true;
Jani Honkonen
Pie chart refactoring
r142 }
Jani Honkonen
Implemented QPieSeries::take()
r1798 /*!
Takes a single \a slice from the series. Does not destroy the slice object.
NOTE: The series remains as the slice's parent object. You must set the
parent object to take full ownership.
Jani Honkonen
Fix some spelling errors
r1932 Returns true if take was successful.
Jani Honkonen
Implemented QPieSeries::take()
r1798 */
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QPieSeries::take(QPieSlice *slice)
Jani Honkonen
Implemented QPieSeries::take()
r1798 {
Q_D(QPieSeries);
if (!d->m_slices.removeOne(slice))
return false;
QPieSlicePrivate::fromSlice(slice)->m_series = 0;
Jani Honkonen
bugfix: pie does not disconnect signals when a slice is taken (not deleted)
r2084 slice->disconnect(d);
Jani Honkonen
Implemented QPieSeries::take()
r1798
d->updateDerivativeData();
Jani Honkonen
more coding style fixes for src-folder...
r2104 emit removed(QList<QPieSlice *>() << slice);
Jani Honkonen
Implemented QPieSeries::take()
r1798 emit countChanged();
return true;
}
Jani Honkonen
Add documentation to pie
r314 /*!
Clears all slices from the series.
*/
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 void QPieSeries::clear()
Jani Honkonen
Pie chart refactoring
r142 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 if (d->m_slices.count() == 0)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 return;
Jani Honkonen
Refactoring piechart API (and internals)
r174
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QPieSlice *> slices = d->m_slices;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, d->m_slices)
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 d->m_slices.removeOne(s);
Jani Honkonen
Refactoring the pie for animations (no actual animations yet)
r566
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 d->updateDerivativeData();
Jani Honkonen
Refactoring pie series and animations.
r621
Jani Honkonen
pie: make slice added/removed signals public (again)
r1213 emit removed(slices);
Jani Honkonen
pie: add everything as a property in series...
r1255 emit countChanged();
Jani Honkonen
bugfix: pie does not disconnect signals when a slice is taken (not deleted)
r2084
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, slices)
Jani Honkonen
bugfix: pie does not disconnect signals when a slice is taken (not deleted)
r2084 delete s;
Jani Honkonen
Pie chart refactoring
r142 }
Jani Honkonen
pieseries: update docs
r1279 /*!
Returns a list of slices that belong to this series.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QPieSlice *> QPieSeries::slices() const
Jani Honkonen
pieseries: update docs
r1279 {
Q_D(const QPieSeries);
return d->m_slices;
}
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
Minor qpieseries doc updates.
r933 returns the number of the slices in this series.
Jani Honkonen
Add documentation to pie
r314 */
int QPieSeries::count() const
{
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
Marek Rosa
Revert: Pie now has defualt Model to which slice data is copied.
r1204 return d->m_slices.count();
Jani Honkonen
Add documentation to pie
r314 }
Jani Honkonen
Refactoring pie series and animations.
r621 /*!
Returns true is the series is empty.
*/
bool QPieSeries::isEmpty() const
{
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
return d->m_slices.isEmpty();
Jani Honkonen
Refactoring pie series and animations.
r621 }
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieseries: update docs
r1279 Returns the sum of all slice values in this series.
\sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage()
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
pieseries: update docs
r1279 qreal QPieSeries::sum() const
Jani Honkonen
Add documentation to pie
r314 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
Jani Honkonen
pieseries: update docs
r1279 return d->m_sum;
Jani Honkonen
Add documentation to pie
r314 }
Marek Rosa
Donut support simplified. Examples updated
r1838 void QPieSeries::setHoleSize(qreal holeSize)
Marek Rosa
Added QDonutGroup class
r1671 {
Q_D(QPieSeries);
Marek Rosa
Donut support simplified. Examples updated
r1838 holeSize = qBound((qreal)0.0, holeSize, (qreal)1.0);
d->setSizes(holeSize, qMax(d->m_pieRelativeSize, holeSize));
Marek Rosa
Added QDonutGroup class
r1671 }
Marek Rosa
Donut support simplified. Examples updated
r1838 qreal QPieSeries::holeSize() const
Marek Rosa
Added QDonutGroup class
r1671 {
Q_D(const QPieSeries);
Marek Rosa
Donut support simplified. Examples updated
r1838 return d->m_holeRelativeSize;
Marek Rosa
Added QDonutGroup class
r1671 }
Tero Ahola
QSeries name and QPieSeries properties to QML api
r884 void QPieSeries::setHorizontalPosition(qreal relativePosition)
{
Q_D(QPieSeries);
Jani Honkonen
pie: add everything as a property in series...
r1255
if (relativePosition < 0.0)
relativePosition = 0.0;
if (relativePosition > 1.0)
relativePosition = 1.0;
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(d->m_pieRelativeHorPos, relativePosition)) {
Jani Honkonen
pie: add everything as a property in series...
r1255 d->m_pieRelativeHorPos = relativePosition;
Tero Ahola
Removed a few signals from QPieSeries API
r1482 emit d->horizontalPositionChanged();
Jani Honkonen
pie: add everything as a property in series...
r1255 }
Tero Ahola
QSeries name and QPieSeries properties to QML api
r884 }
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454
Jani Honkonen
pieseries: update docs
r1279 qreal QPieSeries::horizontalPosition() const
{
Q_D(const QPieSeries);
return d->m_pieRelativeHorPos;
}
Tero Ahola
QSeries name and QPieSeries properties to QML api
r884 void QPieSeries::setVerticalPosition(qreal relativePosition)
Jani Honkonen
Pie chart refactoring
r142 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Jani Honkonen
pie: add everything as a property in series...
r1255
if (relativePosition < 0.0)
relativePosition = 0.0;
if (relativePosition > 1.0)
relativePosition = 1.0;
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(d->m_pieRelativeVerPos, relativePosition)) {
Jani Honkonen
pie: add everything as a property in series...
r1255 d->m_pieRelativeVerPos = relativePosition;
Tero Ahola
Removed a few signals from QPieSeries API
r1482 emit d->verticalPositionChanged();
Jani Honkonen
pie: add everything as a property in series...
r1255 }
Jani Honkonen
Pie chart refactoring
r142 }
Tero Ahola
QSeries name and QPieSeries properties to QML api
r884 qreal QPieSeries::verticalPosition() const
Jani Honkonen
Add documentation to pie
r314 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
return d->m_pieRelativeVerPos;
Jani Honkonen
Add documentation to pie
r314 }
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 void QPieSeries::setPieSize(qreal relativeSize)
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Marek Rosa
Embedded compile fix
r1779 relativeSize = qBound((qreal)0.0, relativeSize, (qreal)1.0);
Marek Rosa
Donut support simplified. Examples updated
r1838 d->setSizes(qMin(d->m_holeRelativeSize, relativeSize), relativeSize);
Jani Honkonen
pie: add everything as a property in series...
r1255
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 }
Jani Honkonen
Add documentation to pie
r314
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 qreal QPieSeries::pieSize() const
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
return d->m_pieRelativeSize;
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 }
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 void QPieSeries::setPieStartAngle(qreal angle)
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (qFuzzyCompare(d->m_pieStartAngle, angle))
Jani Honkonen
Bugfix: remove restrictions from pie start & end angles...
r1207 return;
d->m_pieStartAngle = angle;
d->updateDerivativeData();
Tero Ahola
Removed a few signals from QPieSeries API
r1482 emit d->pieStartAngleChanged();
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 qreal QPieSeries::pieStartAngle() const
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
return d->m_pieStartAngle;
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 }
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454 /*!
Sets the end angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 \a angle must be greater than start angle.
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 \sa pieEndAngle(), pieStartAngle(), setPieStartAngle()
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454 */
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 void QPieSeries::setPieEndAngle(qreal angle)
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (qFuzzyCompare(d->m_pieEndAngle, angle))
Jani Honkonen
Bugfix: remove restrictions from pie start & end angles...
r1207 return;
d->m_pieEndAngle = angle;
d->updateDerivativeData();
Tero Ahola
Removed a few signals from QPieSeries API
r1482 emit d->pieEndAngleChanged();
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 }
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454 /*!
Returns the end angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle()
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454 */
Jani Honkonen
Renamed the "factor" stuff from pie series API.
r498 qreal QPieSeries::pieEndAngle() const
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 {
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(const QPieSeries);
return d->m_pieEndAngle;
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 }
Jani Honkonen
Add documentation to pie
r314 /*!
Sets the all the slice labels \a visible or invisible.
Jani Honkonen
pieseries: update docs
r1279 Note that this affects only the current slices in the series.
If user adds a new slice the default label visibility is false.
Jani Honkonen
Add documentation to pie
r314 \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible()
*/
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 void QPieSeries::setLabelsVisible(bool visible)
{
Jani Honkonen
Adding PIMPL to pie
r669 Q_D(QPieSeries);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, d->m_slices)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 s->setLabelVisible(visible);
}
Marek Rosa
Few docs updated
r1743 /*!
Sets the all the slice labels \a position
Note that this affects only the current slices in the series.
If user adds a new slice the default label position is LabelOutside
\sa QPieSlice::labelPosition(), QPieSlice::setLabelPosition()
*/
Marek Rosa
Added one more type of label placing on Pie chart
r1712 void QPieSeries::setLabelsPosition(QPieSlice::LabelPosition position)
{
Q_D(QPieSeries);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, d->m_slices)
Marek Rosa
Added one more type of label placing on Pie chart
r1712 s->setLabelPosition(position);
}
Michal Klocek
Adds big fat pimpl to series classes...
r938 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) :
QAbstractSeriesPrivate(parent),
Michal Klocek
Adds big fat pimpl to series classes...
r938 m_pieRelativeHorPos(0.5),
m_pieRelativeVerPos(0.5),
m_pieRelativeSize(0.7),
m_pieStartAngle(0),
m_pieEndAngle(360),
Marek Rosa
Added initial donut chart support to Pie series
r1670 m_sum(0),
Marek Rosa
Donut support simplified. Examples updated
r1838 m_holeRelativeSize(0.0)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
}
QPieSeriesPrivate::~QPieSeriesPrivate()
{
}
void QPieSeriesPrivate::updateDerivativeData()
{
Jani Honkonen
Rename pie series total() -> sum() to be consistent with bar series.
r939 // calculate sum of all slices
Jani Honkonen
pie: add everything as a property in series...
r1255 qreal sum = 0;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, m_slices)
Jani Honkonen
pie: add everything as a property in series...
r1255 sum += s->value();
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(m_sum, sum)) {
Jani Honkonen
pie: add everything as a property in series...
r1255 m_sum = sum;
emit q_func()->sumChanged();
}
Michal Klocek
Adds big fat pimpl to series classes...
r938
// nothing to show..
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (qFuzzyCompare(m_sum, 0))
Michal Klocek
Adds big fat pimpl to series classes...
r938 return;
// update slice attributes
qreal sliceAngle = m_pieStartAngle;
qreal pieSpan = m_pieEndAngle - m_pieStartAngle;
Jani Honkonen
more coding style fixes for src-folder...
r2104 QVector<QPieSlice *> changed;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QPieSlice *s, m_slices) {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
d->setPercentage(s->value() / m_sum);
d->setStartAngle(sliceAngle);
d->setAngleSpan(pieSpan * s->percentage());
sliceAngle += s->angleSpan();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274
emit calculatedDataChanged();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Marek Rosa
Inner pie (donut) size cannot be smaller than the outer pie size
r1741 void QPieSeriesPrivate::setSizes(qreal innerSize, qreal outerSize)
{
bool changed = false;
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(m_holeRelativeSize, innerSize)) {
Marek Rosa
Donut support simplified. Examples updated
r1838 m_holeRelativeSize = innerSize;
Marek Rosa
Inner pie (donut) size cannot be smaller than the outer pie size
r1741 changed = true;
}
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (!qFuzzyCompare(m_pieRelativeSize, outerSize)) {
Marek Rosa
Inner pie (donut) size cannot be smaller than the outer pie size
r1741 m_pieRelativeSize = outerSize;
changed = true;
}
if (changed)
emit pieSizeChanged();
}
Jani Honkonen
more coding style fixes for src-folder...
r2104 QPieSeriesPrivate *QPieSeriesPrivate::fromSeries(QPieSeries *series)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 return series->d_func();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 void QPieSeriesPrivate::sliceValueChanged()
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
API review changes for pie
r1009 Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender())));
updateDerivativeData();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Jani Honkonen
API review changes for pie
r1009 void QPieSeriesPrivate::sliceClicked()
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_ASSERT(m_slices.contains(slice));
Q_Q(QPieSeries);
Jani Honkonen
API review changes for pie
r1009 emit q->clicked(slice);
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Jani Honkonen
API review changes for pie
r1009 void QPieSeriesPrivate::sliceHovered(bool state)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_ASSERT(m_slices.contains(slice));
Q_Q(QPieSeries);
Jani Honkonen
API review changes for pie
r1009 emit q->hovered(slice, state);
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Michal Klocek
Refactors internals...
r2273 void QPieSeriesPrivate::initializeDomain()
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Jani Honkonen
Remove scaledomain ect. warnings from pie. Not going to be implemented (for now at least).
r1191 // does not apply to pie
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Michal Klocek
Refactors internals...
r2273 void QPieSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Q_Q(QPieSeries);
Michal Klocek
Refactors internals...
r2273 PieChartItem *pie = new PieChartItem(q,parent);
m_item.reset(pie);
QAbstractSeriesPrivate::initializeGraphics(parent);
}
void QPieSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options)
{
PieChartItem *item = static_cast<PieChartItem *>(m_item.data());
Q_ASSERT(item);
if (options.testFlag(QChart::SeriesAnimations)) {
item->setAnimation(new PieAnimation(item));
}else{
item->setAnimation(0);
}
QAbstractSeriesPrivate::initializeAnimations(options);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Michal Klocek
Adds big fat pimpl to series classes...
r938
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 QList<QLegendMarker*> QPieSeriesPrivate::createLegendMarkers(QLegend* legend)
{
Q_Q(QPieSeries);
QList<QLegendMarker*> markers;
foreach(QPieSlice* slice, q->slices()) {
sauimone
refactoring
r2167 QPieLegendMarker* marker = new QPieLegendMarker(q,slice,legend);
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 markers << marker;
}
return markers;
}
Michal Klocek
Refactors internals...
r2273 void QPieSeriesPrivate::initializeAxes()
sauimone
added createAxis methods to private series
r1545 {
Michal Klocek
Refactors internals...
r2273
sauimone
added createAxis methods to private series
r1545 }
Michal Klocek
Adds axis domain intialization
r1695 QAbstractAxis::AxisType QPieSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
Michal Klocek
Adds createDefaultAxes logic
r1588 {
Michal Klocek
Adds axis domain intialization
r1695 Q_UNUSED(orientation);
Michal Klocek
Adds createDefaultAxes logic
r1588 return QAbstractAxis::AxisTypeNoAxis;
sauimone
added createAxis methods to private series
r1545 }
Michal Klocek
Refactors internals...
r2273 QAbstractAxis* QPieSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
{
Q_UNUSED(orientation);
return 0;
}
void QPieSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
{
Jani Honkonen
Some fixes for Qt5, vs2010 build and qml
r2277 //Q_Q(QPieSeries);
//const QList<QColor>& colors = theme->seriesColors();
Michal Klocek
Refactors internals...
r2273 const QList<QGradient>& gradients = theme->seriesGradients();
for (int i(0); i < m_slices.count(); i++) {
QColor penColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
// Get color for a slice from a gradient linearly, beginning from the start of the gradient
qreal pos = (qreal)(i + 1) / (qreal) m_slices.count();
QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), pos);
QPieSlice *s = m_slices.at(i);
QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
if (forced || d->m_data.m_slicePen.isThemed())
d->setPen(penColor, true);
if (forced || d->m_data.m_sliceBrush.isThemed())
d->setBrush(brushColor, true);
if (forced || d->m_data.m_labelBrush.isThemed())
d->setLabelBrush(theme->labelBrush().color(), true);
if (forced || d->m_data.m_labelFont.isThemed())
d->setLabelFont(theme->labelFont(), true);
}
}
Jani Honkonen
Pie chart refactoring
r142 #include "moc_qpieseries.cpp"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "moc_qpieseries_p.cpp"
Jani Honkonen
Pie chart refactoring
r142
QTCOMMERCIALCHART_END_NAMESPACE