##// END OF EJS Templates
clean up INCLUDEPATH handling...
clean up INCLUDEPATH handling in the c++ module, the .pri files add their directories, so there is no point in a centralized common.pri doing it again. the qml plugin doesn't need to add any paths from the c++ module explicitly, as the QT+=charts-private implies that already. Change-Id: I263dd702e9874e4d6188ca7251a482d0df4e570b Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>

File last commit:

r2845:ae12522d475c
r2886:4c015da23a8e
Show More
qpieslice.cpp
825 lines | 20.3 KiB | text/x-c | CppLexer
Titta Heikkala
Updated license headers...
r2845 /******************************************************************************
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_BEGIN_LICENSE:COMM$
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
******************************************************************************/
Jani Honkonen
Add license headers
r794
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QPieSlice>
#include <private/qpieslice_p.h>
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
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 /*!
\class QPieSlice
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Jani Honkonen
Typo fix for slice doc
r339 \brief Defines a slice in pie series.
Jani Honkonen
Add documentation to pie
r314
Jani Honkonen
Pie doc updates
r952 This object defines the properties of a single slice in a QPieSeries.
Jani Honkonen
More documentation for pie
r320
Jani Honkonen
Pie doc updates
r952 In addition to the obvious value and label properties the user can also control
the visual appearance of a slice. By modifying the visual appearance also means that
Jani Honkonen
pieslice: update docs
r1277 the user is overriding the default appearance set by the theme.
Jani Honkonen
Pie doc updates
r952
Jani Honkonen
pieslice: update docs
r1277 Note that if the user has customized slices and theme is changed all customizations will be lost.
To enable user interaction with the pie some basic signals are provided about clicking and hovering.
Jani Honkonen
Add documentation to pie
r314 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
Titta Heikkala
Fix Charts documentation...
r2639 \qmltype PieSlice
\instantiates QPieSlice
Titta Heikkala
Qt Charts project file structure change...
r2712 \inqmlmodule QtCharts
Tero Ahola
QML PieSlice documentation
r1470
Titta Heikkala
Qt Charts project file structure change...
r2712 \brief Defines a slice in pie series.
PieSlice defines the properties of a single slice in a PieSeries. The element should be used
as a child for a PieSeries. For example:
\snippet qmlpiechart/qml/qmlpiechart/main.qml 2
An alternative (dynamic) method for adding slices to a PieSeries is using PieSeries.append
method.
\snippet qmlpiechart/qml/qmlpiechart/main.qml 4
Tero Ahola
QML PieSlice documentation
r1470
Titta Heikkala
Qt Charts project file structure change...
r2712 In that case you may want to use PieSeries.at or PieSeries.find to access the properties of
an individual PieSlice instance.
\snippet qmlpiechart/qml/qmlpiechart/main.qml 5
\sa PieSeries
Tero Ahola
QML PieSlice documentation
r1470 */
Jani Honkonen
pie: add label position to slice
r1450 /*!
\enum QPieSlice::LabelPosition
This enum describes the position of the slice label.
\value LabelOutside Label is outside the slice with an arm.
Jani Honkonen
QPieSlice::LabelInside -> LabelInsideHorizontal
r1759 \value LabelInsideHorizontal Label is centered inside the slice and laid out horizontally.
\value LabelInsideTangential Label is centered inside the slice and rotated to be parallel to the tangential of the slice's arc.
Marek Rosa
Docs update
r1731 \value LabelInsideNormal Label is centered inside the slice rotated to be parallel to the normal of the slice's arc.
Jani Honkonen
pie: add label position to slice
r1450 */
Jani Honkonen
Add documentation to pie
r314 /*!
\property QPieSlice::label
Label of the slice.
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
Jani Honkonen
pieslice: update docs
r1277 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty string PieSlice::label
Label (text) of the slice.
*/
Jani Honkonen
pieslice: update docs
r1277
/*!
\fn void QPieSlice::labelChanged()
This signal emitted when the slice label has been changed.
Tero Ahola
QML PieSlice documentation
r1470 \sa label
*/
/*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onLabelChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal emitted when the slice label has been changed.
Jani Honkonen
pieslice: update docs
r1277 \sa label
Jani Honkonen
Add documentation to pie
r314 */
/*!
\property QPieSlice::value
Value of the slice.
Jani Honkonen
pie: make it impossible to add negative slice values
r1280 Note that if users sets a negative value it is converted to a positive value.
Jani Honkonen
Pie doc updates
r952 \sa percentage(), QPieSeries::sum()
Jani Honkonen
Add documentation to pie
r314 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty real PieSlice::value
Value of the slice. Note that if users sets a negative value it is converted to a positive value.
*/
Jani Honkonen
Add documentation to pie
r314
/*!
Jani Honkonen
pieslice: update docs
r1277 \fn void QPieSlice::valueChanged()
This signal is emitted when the slice value changes.
Tero Ahola
QML PieSlice documentation
r1470 \sa value
*/
/*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onValueChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when the slice value changes.
Jani Honkonen
pieslice: update docs
r1277 \sa value
*/
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
pieslice: update docs
r1277 \property QPieSlice::labelVisible
Tero Ahola
QML PieSlice documentation
r1470 Defines the visibility of slice label. By default the label is not visible.
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 \sa label, labelBrush, labelFont, labelArmLengthFactor
Jani Honkonen
Add documentation to pie
r314 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty bool PieSlice::labelVisible
Defines the visibility of slice label. By default the label is not visible.
*/
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
pieslice: update docs
r1277 \fn void QPieSlice::labelVisibleChanged()
This signal emitted when visibility of the slice label has changed.
Tero Ahola
QML PieSlice documentation
r1470 \sa labelVisible
*/
/*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onLabelVisibleChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal emitted when visibility of the slice label has changed.
Jani Honkonen
pieslice: update docs
r1277 \sa labelVisible
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
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \property QPieSlice::exploded
Tero Ahola
QML PieSlice documentation
r1470 If set to true the slice is "exploded" away from the pie.
\sa explodeDistanceFactor
*/
/*!
\qmlproperty bool PieSlice::exploded
If set to true the slice is "exploded" away from the pie.
Jani Honkonen
pieslice: update docs
r1277 \sa explodeDistanceFactor
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
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \property QPieSlice::pen
Pen used to draw the slice border.
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
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \fn void QPieSlice::penChanged()
This signal is emitted when the pen of the slice has changed.
\sa pen
*/
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 /*!
\property QPieSlice::borderColor
Color used to draw the slice border.
This is a convenience property for modifying the slice pen.
\sa pen, borderWidth
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty color PieSlice::borderColor
Color used to draw the slice border (pen color).
\sa borderWidth
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
/*!
\fn void QPieSlice::borderColorChanged()
This signal is emitted when slice border color changes.
\sa pen, borderColor
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onBorderColorChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when slice border color changes.
\sa borderColor
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
/*!
\property QPieSlice::borderWidth
Width of the slice border.
This is a convenience property for modifying the slice pen.
\sa pen, borderColor
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty int PieSlice::borderWidth
Width of the slice border.
This is a convenience property for modifying the slice pen.
\sa borderColor
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
/*!
\fn void QPieSlice::borderWidthChanged()
This signal is emitted when slice border width changes.
\sa pen, borderWidth
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onBorderWidthChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when slice border width changes.
\sa borderWidth
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
Jani Honkonen
pieslice: update docs
r1277 /*!
\property QPieSlice::brush
Brush used to draw the slice.
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
Make pie fit better inside its given rectangle. Label texts still go outside. Needs a bit more work...
r289
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \fn void QPieSlice::brushChanged()
This signal is emitted when the brush of the slice has changed.
\sa brush
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
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 /*!
\qmlproperty QString PieSlice::brushFilename
The name of the file used as a brush for the slice.
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 /*!
\property QPieSlice::color
Tero Ahola
QML PieSlice documentation
r1470 Fill (brush) color of the slice.
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 This is a convenience property for modifying the slice brush.
\sa brush
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty color PieSlice::color
Fill (brush) color of the slice.
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
/*!
\fn void QPieSlice::colorChanged()
This signal is emitted when slice color changes.
\sa brush
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onColorChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when slice color changes.
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
Jani Honkonen
Add documentation to pie
r314 /*!
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 \property QPieSlice::labelBrush
Tero Ahola
QML PieSlice documentation
r1470 Brush used to draw label and label arm of the slice.
Jani Honkonen
pieslice: update docs
r1277 \sa label, labelVisible, labelFont, labelArmLengthFactor
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
Jani Honkonen
Add documentation to pie
r314 /*!
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 \fn void QPieSlice::labelBrushChanged()
Tero Ahola
Documented QLegend label properties
r1529 This signal is emitted when the label brush of the slice has changed.
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 \sa labelBrush
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
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 /*!
\property QPieSlice::labelColor
Color used to draw the slice label.
This is a convenience property for modifying the slice label brush.
\sa labelBrush
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty color PieSlice::labelColor
Color used to draw the slice label.
*/
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
/*!
\fn void QPieSlice::labelColorChanged()
This signal is emitted when slice label color changes.
Tero Ahola
QML PieSlice documentation
r1470 \sa labelColor
*/
/*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onLabelColorChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when slice label color changes.
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 \sa labelColor
*/
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \property QPieSlice::labelFont
Font used for drawing label text.
\sa label, labelVisible, labelArmLengthFactor
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
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \fn void QPieSlice::labelFontChanged()
This signal is emitted when the label font of the slice has changed.
\sa labelFont
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
Jani Honkonen
Add qml Font properties & docs
r1517 /*!
\qmlproperty Font PieSlice::labelFont
Defines the font used for slice label.
Titta Heikkala
Fix Charts documentation...
r2639 See the Qt documentation for more details of Font.
Jani Honkonen
Add qml Font properties & docs
r1517
\sa labelVisible, labelPosition
*/
Jani Honkonen
pie: add label position to slice
r1450 /*!
\property QPieSlice::labelPosition
Position of the slice label.
\sa label, labelVisible
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty LabelPosition PieSlice::labelPosition
Tero Ahola
List of slices and barsets as metatypes in decl plugin
r2116 Position of the slice label. One of PieSlice.LabelOutside, PieSlice.LabelInsideHorizontal,
PieSlice.LabelInsideTangential or PieSlice.LabelInsideNormal. By default the position is
PieSlice.LabelOutside.
Tero Ahola
QML PieSlice documentation
r1470 \sa labelVisible
*/
Jani Honkonen
pie: add label position to slice
r1450
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
pieslice: update docs
r1277 \property QPieSlice::labelArmLengthFactor
Defines the length of the label arm.
The factor is relative to pie radius. For example:
1.0 means the length is the same as the radius.
0.5 means the length is half of the radius.
Tero Ahola
QML PieSlice documentation
r1470 By default the arm length is 0.15
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 \sa label, labelVisible, labelBrush, labelFont
Jani Honkonen
Add documentation to pie
r314 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty real PieSlice::labelArmLengthFactor
Defines the length of the label arm.
The factor is relative to pie radius. For example:
1.0 means the length is the same as the radius.
0.5 means the length is half of the radius.
By default the arm length is 0.15
\sa labelVisible
*/
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
pieslice: update docs
r1277 \property QPieSlice::explodeDistanceFactor
When the slice is exploded this factor defines how far the slice is exploded away from the pie.
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454 The factor is relative to pie radius. For example:
Jani Honkonen
pieslice: update docs
r1277 1.0 means the distance is the same as the radius.
0.5 means the distance is half of the radius.
Tero Ahola
QML PieSlice documentation
r1470 By default the distance is is 0.15
\sa exploded
*/
/*!
\qmlproperty real PieSlice::explodeDistanceFactor
When the slice is exploded this factor defines how far the slice is exploded away from the pie.
The factor is relative to pie radius. For example:
1.0 means the distance is the same as the radius.
0.5 means the distance is half of the radius.
By default the distance is is 0.15
Jani Honkonen
pieslice: update docs
r1277 \sa exploded
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
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 /*!
Jani Honkonen
pieslice: update docs
r1277 \property QPieSlice::percentage
Percentage of the slice compared to the sum of all slices in the series.
The actual value ranges from 0.0 to 1.0.
Updated automatically once the slice is added to the series.
\sa value, QPieSeries::sum
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlproperty real PieSlice::percentage
Percentage of the slice compared to the sum of all slices in the series.
The actual value ranges from 0.0 to 1.0.
Updated automatically once the slice is added to the series.
*/
Jani Honkonen
pieslice: update docs
r1277
/*!
\fn void QPieSlice::percentageChanged()
This signal is emitted when the percentage of the slice has changed.
Tero Ahola
QML PieSlice documentation
r1470 \sa percentage
*/
/*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal void PieSlice::onPercentageChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when the percentage of the slice has changed.
Jani Honkonen
pieslice: update docs
r1277 \sa percentage
*/
/*!
\property QPieSlice::startAngle
Defines the starting angle of this slice in the series it belongs to.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Tero Ahola
QML PieSlice documentation
r1470 Updated automatically once the slice is added to the series.
*/
/*!
\qmlproperty real PieSlice::startAngle
Defines the starting angle of this slice in the series it belongs to.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Jani Honkonen
pieslice: update docs
r1277 Updated automatically once the slice is added to the series.
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 */
/*!
Jani Honkonen
pieslice: update docs
r1277 \fn void QPieSlice::startAngleChanged()
This signal is emitted when the starting angle f the slice has changed.
Tero Ahola
QML PieSlice documentation
r1470 \sa startAngle
*/
/*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onStartAngleChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when the starting angle f the slice has changed.
Jani Honkonen
pieslice: update docs
r1277 \sa startAngle
*/
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224
Jani Honkonen
pieslice: update docs
r1277 /*!
\property QPieSlice::angleSpan
Span of the slice in degrees.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Tero Ahola
QML PieSlice documentation
r1470 Updated automatically once the slice is added to the series.
*/
/*!
\qmlproperty real PieSlice::angleSpan
Span of the slice in degrees.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Jani Honkonen
pieslice: update docs
r1277 Updated automatically once the slice is added to the series.
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 */
/*!
Jani Honkonen
pieslice: update docs
r1277 \fn void QPieSlice::angleSpanChanged()
This signal is emitted when the angle span of the slice has changed.
\sa angleSpan
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal PieSlice::onAngleSpanChanged()
Tero Ahola
QML PieSlice documentation
r1470 This signal is emitted when the angle span of the slice has changed.
\sa angleSpan
*/
Jani Honkonen
pieslice: update docs
r1277
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
API review changes for pie
r1009 \fn void QPieSlice::clicked()
Jani Honkonen
Add documentation to pie
r314 This signal is emitted when user has clicked the slice.
\sa QPieSeries::clicked()
*/
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlsignal PieSlice::onClicked()
This signal is emitted when user has clicked the slice.
*/
Jani Honkonen
Add documentation to pie
r314
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 /*!
\fn void QPieSlice::pressed()
This signal is emitted when user has pressed the slice.
\sa QPieSeries::pressed()
*/
/*!
\qmlsignal PieSlice::onPressed()
This signal is emitted when user has pressed the slice.
*/
/*!
\fn void QPieSlice::released()
This signal is emitted when user has released the slice.
\sa QPieSeries::released()
*/
/*!
\qmlsignal PieSlice::onReleased()
This signal is emitted when user has released the slice.
*/
/*!
\fn void QPieSlice::doubleClicked()
This signal is emitted when user has doubleclicked the slice.
\sa QPieSeries::doubleClicked()
*/
/*!
\qmlsignal PieSlice::onDoubleClicked()
This signal is emitted when user has doubleclicked the slice.
*/
Jani Honkonen
Add documentation to pie
r314 /*!
Jani Honkonen
API review changes for pie
r1009 \fn void QPieSlice::hovered(bool state)
This signal is emitted when user has hovered over or away from the slice.
\a state is true when user has hovered over the slice and false when hover has moved away from the slice.
\sa QPieSeries::hovered()
Jani Honkonen
Add documentation to pie
r314 */
Tero Ahola
QML PieSlice documentation
r1470 /*!
\qmlsignal PieSlice::onHovered(bool state)
This signal is emitted when user has hovered over or away from the slice.
\a state is true when user has hovered over the slice and false when hover has moved away from the slice.
*/
Jani Honkonen
Add documentation to pie
r314
/*!
Jani Honkonen
pieslice: update docs
r1277 Constructs an empty slice with a \a parent.
\sa QPieSeries::append(), QPieSeries::insert()
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
pieslice: update docs
r1277 QPieSlice::QPieSlice(QObject *parent)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QObject(parent),
d_ptr(new QPieSlicePrivate(this))
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
pieslice: update docs
r1277
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
pieslice: update docs
r1277 Constructs an empty slice with given \a value, \a label and a \a parent.
\sa QPieSeries::append(), QPieSeries::insert()
Jani Honkonen
Add documentation to pie
r314 */
Jani Honkonen
pieslice: update docs
r1277 QPieSlice::QPieSlice(QString label, qreal value, QObject *parent)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QObject(parent),
d_ptr(new QPieSlicePrivate(this))
Jani Honkonen
pieslice: update docs
r1277 {
Jani Honkonen
pie: make it impossible to add negative slice values
r1280 setValue(value);
setLabel(label);
Jani Honkonen
pieslice: update docs
r1277 }
/*!
Destroys the slice.
User should not delete the slice if it has been added to the series.
*/
QPieSlice::~QPieSlice()
{
}
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 void QPieSlice::setLabel(QString label)
{
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 if (d_ptr->m_data.m_labelText != label) {
d_ptr->m_data.m_labelText = label;
Jani Honkonen
pie: remove changed() signal and replace it with more refined signals...
r1224 emit labelChanged();
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
}
Jani Honkonen
pieslice: update docs
r1277 QString QPieSlice::label() const
{
return d_ptr->m_data.m_labelText;
}
void QPieSlice::setValue(qreal value)
{
Jani Honkonen
pie: make it impossible to add negative slice values
r1280 value = qAbs(value); // negative values not allowed
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_ptr->m_data.m_value, value)) {
Jani Honkonen
pieslice: update docs
r1277 d_ptr->m_data.m_value = value;
emit valueChanged();
}
}
qreal QPieSlice::value() const
{
return d_ptr->m_data.m_value;
}
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 void QPieSlice::setLabelVisible(bool visible)
{
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 if (d_ptr->m_data.m_isLabelVisible != visible) {
d_ptr->m_data.m_isLabelVisible = visible;
emit labelVisibleChanged();
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
}
Jani Honkonen
pieslice: update docs
r1277 bool QPieSlice::isLabelVisible() const
{
return d_ptr->m_data.m_isLabelVisible;
}
Jani Honkonen
Pie doc updates
r952
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 void QPieSlice::setExploded(bool exploded)
{
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 if (d_ptr->m_data.m_isExploded != exploded) {
d_ptr->m_data.m_isExploded = exploded;
Tero Ahola
Removed unnecessary signals from QPieSlice
r1494 emit d_ptr->explodedChanged();
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
}
Jani Honkonen
pie: add label position to slice
r1450 QPieSlice::LabelPosition QPieSlice::labelPosition()
{
return d_ptr->m_data.m_labelPosition;
}
void QPieSlice::setLabelPosition(LabelPosition position)
{
if (d_ptr->m_data.m_labelPosition != position) {
d_ptr->m_data.m_labelPosition = position;
Tero Ahola
Removed unnecessary signals from QPieSlice
r1494 emit d_ptr->labelPositionChanged();
Jani Honkonen
pie: add label position to slice
r1450 }
}
Jani Honkonen
pieslice: update docs
r1277 bool QPieSlice::isExploded() const
Jani Honkonen
Make pie fit better inside its given rectangle. Label texts still go outside. Needs a bit more work...
r289 {
Jani Honkonen
pieslice: update docs
r1277 return d_ptr->m_data.m_isExploded;
Jani Honkonen
Make pie fit better inside its given rectangle. Label texts still go outside. Needs a bit more work...
r289 }
Jani Honkonen
remove "slice" word from pen/brush setters/getters
r756 void QPieSlice::setPen(const QPen &pen)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d_ptr->setPen(pen, false);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
pieslice: update docs
r1277 QPen QPieSlice::pen() const
{
return d_ptr->m_data.m_slicePen;
}
Jani Honkonen
Pie doc updates
r952
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 QColor QPieSlice::borderColor()
{
return pen().color();
}
void QPieSlice::setBorderColor(QColor color)
{
QPen p = pen();
if (color != p.color()) {
p.setColor(color);
setPen(p);
}
}
int QPieSlice::borderWidth()
{
return pen().width();
}
void QPieSlice::setBorderWidth(int width)
{
QPen p = pen();
if (width != p.width()) {
p.setWidth(width);
setPen(p);
}
}
Jani Honkonen
remove "slice" word from pen/brush setters/getters
r756 void QPieSlice::setBrush(const QBrush &brush)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d_ptr->setBrush(brush, false);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
pieslice: update docs
r1277 QBrush QPieSlice::brush() const
{
return d_ptr->m_data.m_sliceBrush;
}
Jani Honkonen
Pie doc updates
r952
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 QColor QPieSlice::color()
{
return brush().color();
}
void QPieSlice::setColor(QColor color)
{
QBrush b = brush();
Tero Ahola
Fixed bug in initializing color of a slice
r1830
if (b == QBrush())
b.setStyle(Qt::SolidPattern);
b.setColor(color);
setBrush(b);
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 }
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 void QPieSlice::setLabelBrush(const QBrush &brush)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 d_ptr->setLabelBrush(brush, false);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 QBrush QPieSlice::labelBrush() const
Jani Honkonen
pieslice: update docs
r1277 {
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 return d_ptr->m_data.m_labelBrush;
Jani Honkonen
pieslice: update docs
r1277 }
Jani Honkonen
Pie doc updates
r952
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 QColor QPieSlice::labelColor()
{
return labelBrush().color();
}
void QPieSlice::setLabelColor(QColor color)
{
QBrush b = labelBrush();
if (color != b.color()) {
b.setColor(color);
setLabelBrush(b);
}
}
Jani Honkonen
Renaming pen & brush functions for pie and adding const
r469 void QPieSlice::setLabelFont(const QFont &font)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d_ptr->setLabelFont(font, false);
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
Jani Honkonen
pieslice: update docs
r1277 QFont QPieSlice::labelFont() const
{
return d_ptr->m_data.m_labelFont;
}
Jani Honkonen
Introducing vertical and horizontal factors to control the position of the pie.
r454
void QPieSlice::setLabelArmLengthFactor(qreal factor)
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 {
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_ptr->m_data.m_labelArmLengthFactor, factor)) {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 d_ptr->m_data.m_labelArmLengthFactor = factor;
Tero Ahola
Removed unnecessary signals from QPieSlice
r1494 emit d_ptr->labelArmLengthFactorChanged();
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 }
}
Jani Honkonen
pieslice: update docs
r1277 qreal QPieSlice::labelArmLengthFactor() const
{
return d_ptr->m_data.m_labelArmLengthFactor;
}
void QPieSlice::setExplodeDistanceFactor(qreal factor)
{
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_ptr->m_data.m_explodeDistanceFactor, factor)) {
Jani Honkonen
pieslice: update docs
r1277 d_ptr->m_data.m_explodeDistanceFactor = factor;
Tero Ahola
Removed unnecessary signals from QPieSlice
r1494 emit d_ptr->explodeDistanceFactorChanged();
Jani Honkonen
pieslice: update docs
r1277 }
}
qreal QPieSlice::explodeDistanceFactor() const
{
return d_ptr->m_data.m_explodeDistanceFactor;
}
qreal QPieSlice::percentage() const
{
return d_ptr->m_data.m_percentage;
}
qreal QPieSlice::startAngle() const
{
return d_ptr->m_data.m_startAngle;
}
qreal QPieSlice::angleSpan() const
{
return d_ptr->m_data.m_angleSpan;
}
Jani Honkonen
Add QPieSlice::series() and tests
r1323 /*!
Returns the series that this slice belongs to.
\sa QPieSeries::append()
*/
QPieSeries *QPieSlice::series() const
{
return d_ptr->m_series;
}
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 QPieSlicePrivate::QPieSlicePrivate(QPieSlice *parent)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QObject(parent),
q_ptr(parent),
m_series(0)
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 {
}
QPieSlicePrivate::~QPieSlicePrivate()
{
}
QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
{
return slice->d_func();
}
void QPieSlicePrivate::setPen(const QPen &pen, bool themed)
{
if (m_data.m_slicePen != pen) {
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
QPen oldPen = m_data.m_slicePen;
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 m_data.m_slicePen = pen;
m_data.m_slicePen.setThemed(themed);
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 emit q_ptr->penChanged();
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 if (oldPen.color() != pen.color())
emit q_ptr->borderColorChanged();
if (oldPen.width() != pen.width())
emit q_ptr->borderWidthChanged();
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 }
}
void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed)
{
if (m_data.m_sliceBrush != brush) {
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
QBrush oldBrush = m_data.m_sliceBrush;
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 m_data.m_sliceBrush = brush;
m_data.m_sliceBrush.setThemed(themed);
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 emit q_ptr->brushChanged();
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 if (oldBrush.color() != brush.color())
emit q_ptr->colorChanged();
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 }
}
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed)
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 {
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 if (m_data.m_labelBrush != brush) {
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
QBrush oldBrush = m_data.m_labelBrush;
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 m_data.m_labelBrush = brush;
m_data.m_labelBrush.setThemed(themed);
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338
Tero Ahola
Use labelBrush instead of labelPen for text labels
r1307 emit q_ptr->labelBrushChanged();
Jani Honkonen
Fix issues with pen/brush convenience properties and update docs
r1338 if (oldBrush.color() != brush.color())
emit q_ptr->labelColorChanged();
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 }
}
void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
{
if (m_data.m_labelFont != font) {
m_data.m_labelFont = font;
m_data.m_labelFont.setThemed(themed);
emit q_ptr->labelFontChanged();
}
}
void QPieSlicePrivate::setPercentage(qreal percentage)
{
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_data.m_percentage, percentage)) {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 m_data.m_percentage = percentage;
emit q_ptr->percentageChanged();
}
}
void QPieSlicePrivate::setStartAngle(qreal angle)
{
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_data.m_startAngle, angle)) {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 m_data.m_startAngle = angle;
emit q_ptr->startAngleChanged();
}
}
void QPieSlicePrivate::setAngleSpan(qreal span)
{
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_data.m_angleSpan, span)) {
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 m_data.m_angleSpan = span;
emit q_ptr->angleSpanChanged();
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 }
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE
Tero Ahola
Fixed compilation issue on Qt 4.7
r837
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_USE_NAMESPACE
Tero Ahola
Fixed compilation issue on Qt 4.7
r837 #include "moc_qpieslice.cpp"
Jani Honkonen
pie: added everything as a property in QPieSlice...
r1274 #include "moc_qpieslice_p.cpp"