diff --git a/src/piechart/piesliceitem.cpp b/src/piechart/piesliceitem.cpp index f8e5b6d..d82aa1c 100644 --- a/src/piechart/piesliceitem.cpp +++ b/src/piechart/piesliceitem.cpp @@ -86,12 +86,12 @@ void PieSliceItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*op void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent* /*event*/) { - emit hoverEnter(); + emit hoverEnter(); // TODO: refactor emit hover(somebooleanvalue) } void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/) { - emit hoverLeave(); + emit hoverLeave(); // TODO: refactor emit hover(somebooleanvalue) } void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp index 5c1116a..32407ae 100644 --- a/src/piechart/qpieseries.cpp +++ b/src/piechart/qpieseries.cpp @@ -35,12 +35,16 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \class QPieSeries \brief Pie series API for QtCommercial Charts - The pie series defines a pie chart which consists of pie slices which are QPieSlice objects. + The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects. The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. The actual slice size is determined by that relative value. - By default the pie is defined as a full pie but it can be a partial pie. + 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. This can be done by setting a starting angle and angle span to the series. + Full pie is 360 degrees where 0 is at 12 a'clock. */ /*! @@ -219,7 +223,7 @@ void QPieSeries::insert(int index, QPieSlice* slice) /*! Removes a single \a slice from the series and deletes the slice. - Do not reference this pointer after this call. + Do not reference the pointer after this call. */ void QPieSeries::remove(QPieSlice* slice) { @@ -382,7 +386,7 @@ void QPieSeries::setLabelsVisible(bool visible) /*! Returns the sum of all slice values in this series. - \sa QPieSlice::value(), QPieSlice::setValue() + \sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage() */ qreal QPieSeries::sum() const { diff --git a/src/piechart/qpieslice.cpp b/src/piechart/qpieslice.cpp index 51894e0..7c16229 100644 --- a/src/piechart/qpieslice.cpp +++ b/src/piechart/qpieslice.cpp @@ -27,11 +27,15 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \class QPieSlice \brief Defines a slice in pie series. - Holds all the data of a single slice in a QPieSeries and provides the means - to modify slice data and customize the visual appearance of the slice. + This object defines the properties of a single slice in a QPieSeries. - It also provides the means to customize user interaction with the slice by - providing signals for clicking and hover events. + 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 + the user is overriding the default appearance set by the theme. Even if the theme is + changed users settings will persist. + + To enable user interaction customization with the slices some basic signals + are provided about clicking and hovering. */ /*! @@ -44,14 +48,14 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \property QPieSlice::value Value of the slice. + + \sa percentage(), QPieSeries::sum() */ /*! Constructs an empty slice with a \a parent. - Note that QPieSeries takes ownership of the slice when it is set/added. - - \sa QPieSeries::replace(), QPieSeries::append() + \sa QPieSeries::append(), QPieSeries::insert(), QPieSeries::replace() */ QPieSlice::QPieSlice(QObject *parent) :QObject(parent), @@ -62,8 +66,7 @@ QPieSlice::QPieSlice(QObject *parent) /*! Constructs an empty slice with given \a value, \a label and a \a parent. - Note that QPieSeries takes ownership of the slice when it is set/added. - \sa QPieSeries::replace(), QPieSeries::append() + \sa QPieSeries::append(), QPieSeries::insert(), QPieSeries::replace() */ QPieSlice::QPieSlice(qreal value, QString label, QObject *parent) :QObject(parent), @@ -112,7 +115,7 @@ bool QPieSlice::isLabelVisible() const /*! Returns true if slice is exloded from the pie. - \sa setExploded(), setExplodeDistanceFactor() + \sa setExploded(), explodeDistanceFactor(), setExplodeDistanceFactor() */ bool QPieSlice::isExploded() const { @@ -128,7 +131,7 @@ bool QPieSlice::isExploded() const Default value is 0.15. - \sa setExplodeDistanceFactor() + \sa setExplodeDistanceFactor(), isExploded(), setExploded() */ qreal QPieSlice::explodeDistanceFactor() const { @@ -136,10 +139,12 @@ qreal QPieSlice::explodeDistanceFactor() const } /*! - Returns the percentage of this slice compared to all slices in the same series. + Returns the percentage of this slice compared to the sum of all slices in the same series. The returned value ranges from 0 to 1.0. Updated internally after the slice is added to the series. + + \sa QPieSeries::sum() */ qreal QPieSlice::percentage() const { @@ -296,8 +301,11 @@ void QPieSlice::setLabelVisible(bool visible) } /*! - Sets this slice \a exploded. - \sa isExploded(), explodeDistanceFactor() + Sets this slices \a exploded state. + + If the slice is exploded it is moved away from the pie center. The distance is defined by the explode distance factor. + + \sa isExploded(), explodeDistanceFactor(), setExplodeDistanceFactor() */ void QPieSlice::setExploded(bool exploded) { @@ -316,7 +324,7 @@ void QPieSlice::setExploded(bool exploded) Default value is 0.15 - \sa explodeDistanceFactor() + \sa explodeDistanceFactor(), isExploded(), setExploded() */ void QPieSlice::setExplodeDistanceFactor(qreal factor) { @@ -328,7 +336,9 @@ void QPieSlice::setExplodeDistanceFactor(qreal factor) /*! Sets the \a pen used to draw this slice. - Note that applying a theme will override this. + + Overrides the pen set by the theme. + \sa pen() */ void QPieSlice::setPen(const QPen &pen) @@ -342,7 +352,9 @@ void QPieSlice::setPen(const QPen &pen) /*! Sets the \a brush used to draw this slice. - Note that applying a theme will override this. + + Overrides the brush set by the theme. + \sa brush() */ void QPieSlice::setBrush(const QBrush &brush) @@ -356,7 +368,9 @@ void QPieSlice::setBrush(const QBrush &brush) /*! Sets the \a pen used to draw the label in this slice. - Note that applying a theme will override this. + + Overrides the pen set by the theme. + \sa labelPen() */ void QPieSlice::setLabelPen(const QPen &pen) @@ -370,7 +384,9 @@ void QPieSlice::setLabelPen(const QPen &pen) /*! Sets the \a font used to draw the label in this slice. - Note that applying a theme will override this. + + Overrides the font set by the theme. + \sa labelFont() */ void QPieSlice::setLabelFont(const QFont &font)