From a085dc02ea0c9712548ed6babcfce6410adc55d8 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 9 Jan 2017 16:53:49 +0100 Subject: Doc: Edit pie model mapper class and type docs Change-Id: I68cb5ae61dc8ecf4eccfa8a2b6d195903ed2e4ea Reviewed-by: Miikka Heikkinen --- src/charts/piechart/qhpiemodelmapper.cpp | 97 ++++++++++++++++--------------- src/charts/piechart/qvpiemodelmapper.cpp | 98 +++++++++++++++++--------------- 2 files changed, 105 insertions(+), 90 deletions(-) (limited to 'src/charts/piechart') diff --git a/src/charts/piechart/qhpiemodelmapper.cpp b/src/charts/piechart/qhpiemodelmapper.cpp index aced7355..d7ba19c1 100644 --- a/src/charts/piechart/qhpiemodelmapper.cpp +++ b/src/charts/piechart/qhpiemodelmapper.cpp @@ -34,12 +34,15 @@ QT_CHARTS_BEGIN_NAMESPACE /*! \class QHPieModelMapper \inmodule Qt Charts - \brief Horizontal model mapper for pie series. + \brief The QHPieModelMapper is a horizontal model mapper for pie series. + + Model mappers enable using a data model derived from the QAbstractItemModel class + as a data source for a chart. A horizontal model mapper is used to create a connection + between a data model and QPieSeries, so that each column in the data model defines a + pie slice and each row maps to the label or the value of the pie slice. - Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. - Horizontal model mapper is used to create a connection between QPieSeries and QAbstractItemModel derived model object that keeps the consecutive pie slices data in rows. - It is possible to use both QAbstractItemModel and QPieSeries model API. QHPieModelMapper makes sure that Pie and the model are kept in sync. - \note Used model has to support adding/removing rows/columns and modifying the data of the cells. + Both model and pie series properties can be used to manipulate the data. The model + mapper keeps the pie series and the data model in sync. */ /*! \qmltype HPieModelMapper @@ -48,12 +51,16 @@ QT_CHARTS_BEGIN_NAMESPACE \brief Horizontal model mapper for pie series. - HPieModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as - a data source for a pie series. It is possible to use both QAbstractItemModel and PieSeries data - API to manipulate data. HPieModelMapper keeps the Pie and the model in sync. + Model mappers enable using a data model derived from the QAbstractItemModel class + as a data source for a chart. A horizontal model mapper is used to create a connection + between a data model and PieSeries, so that each column in the data model defines a + pie slice and each row maps to the label or the value of the pie slice. - The following QML example would create a pie series with four slices (assuming the model has - at least five columns). Each slice would contain a label from row 1 and a value from row 2. + Both model and pie series properties can be used to manipulate the data. The model + mapper keeps the pie series and the data model in sync. + + The following QML example creates a pie series with four slices (assuming the model has + at least five columns). Each slice gets a label from row 1 and a value from row 2. \code HPieModelMapper { series: pieSeries @@ -68,109 +75,111 @@ QT_CHARTS_BEGIN_NAMESPACE /*! \property QHPieModelMapper::series - \brief Defines the QPieSeries object that is used by the mapper. + \brief The pie series that is used by the mapper. All the data in the series is discarded when it is set to the mapper. - When new series is specified the old series is disconnected (it preserves its data) + When a new series is specified, the old series is disconnected (but it preserves its data). */ /*! \qmlproperty PieSeries HPieModelMapper::series - Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a + The PieSeries object that is used by the mapper. If you define the mapper element as a child for a PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper. - When new series is specified the old series is disconnected (it preserves its data). + When a new series is specified, the old series is disconnected (but it preserves its data). */ /*! \property QHPieModelMapper::model - \brief Defines the model that is used by the mapper. + \brief The model that is used by the mapper. */ /*! \qmlproperty SomeModel HPieModelMapper::model The QAbstractItemModel based model that is used by the mapper. You need to implement the model - and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying - the data of the cells. + and expose it to QML. + + \note The model has to support adding and removing rows or columns and modifying + the data in the cells. */ /*! \property QHPieModelMapper::valuesRow - \brief Defines which row of the model is kept in sync with the values of the pie's slices. + \brief The row of the model that is kept in sync with the values of the pie's slices. - Default value is: -1 (invalid mapping) + The default value is -1 (invalid mapping). */ /*! \qmlproperty int HPieModelMapper::valuesRow - Defines which row of the model is kept in sync with the values of the pie's slices. Default value is: -1 (invalid - mapping). + The row of the model that is kept in sync with the values of the pie's slices. + The default value is -1 (invalid mapping). */ /*! \property QHPieModelMapper::labelsRow - \brief Defines which row of the model is kept in sync with the labels of the pie's slices. + \brief The row of the model that is kept in sync with the labels of the pie's slices. - Default value is: -1 (invalid mapping) + The default value is -1 (invalid mapping). */ /*! \qmlproperty int HPieModelMapper::labelsRow - Defines which row of the model is kept in sync with the labels of the pie's slices - Default value is: -1 (invalid mapping) + The row of the model that is kept in sync with the labels of the pie's slices. + The default value is -1 (invalid mapping). */ /*! \property QHPieModelMapper::firstColumn - \brief Defines which column of the model contains the first slice value. + \brief The column of the model that contains the first slice value. - Minimal and default value is: 0 + The minimum and default value is 0. */ /*! \qmlproperty int HPieModelMapper::firstColumn - Defines which column of the model contains the first slice value. + The column of the model that contains the first slice value. The default value is 0. */ /*! \property QHPieModelMapper::columnCount - \brief Defines the number of columns of the model that are mapped as the data for QPieSeries. + \brief The number of columns of the model that are mapped as the data for the pie series. - Minimal and default value is: -1 (count limited by the number of columns in the model) + The minimum and default value is -1 (number limited to the number of columns in the model). */ /*! \qmlproperty int HPieModelMapper::columnCount - Defines the number of columns of the model that are mapped as the data for QPieSeries. The default value is - -1 (count limited by the number of columns in the model) + The number of columns of the model that are mapped as the data for the pie series. + The default value is -1 (number limited by the number of columns in the model). */ /*! \fn void QHPieModelMapper::seriesReplaced() - Emitted when the series to which mapper is connected to has changed. + This signal is emitted when the series that the mapper is connected to changes. */ /*! \fn void QHPieModelMapper::modelReplaced() - Emitted when the model to which mapper is connected to has changed. + This signal is emitted when the model that the mapper is connected to changes. */ /*! \fn void QHPieModelMapper::valuesRowChanged() - Emitted when the valuesRow has changed. + This signal is emitted when the values row changes. */ /*! \fn void QHPieModelMapper::labelsRowChanged() - Emitted when the labelsRow has changed. + This signal is emitted when the labels row changes. */ /*! \fn void QHPieModelMapper::firstColumnChanged() - Emitted when the firstColumn has changed. + This signal is emitted when the first column changes. */ /*! \fn void QHPieModelMapper::columnCountChanged() - Emitted when the columnCount has changed. + This signal is emitted when the number of columns changes. */ /*! - Constructs a mapper object which is a child of \a parent. + Constructs a mapper object that is a child of \a parent. */ QHPieModelMapper::QHPieModelMapper(QObject *parent) : QPieModelMapper(parent) @@ -205,7 +214,7 @@ void QHPieModelMapper::setSeries(QPieSeries *series) } /*! - Returns which row of the model is kept in sync with the values of the pie's slices + Returns the row of the model that is kept in sync with the values of the pie's slices. */ int QHPieModelMapper::valuesRow() const { @@ -213,8 +222,7 @@ int QHPieModelMapper::valuesRow() const } /*! - Sets the model row that is kept in sync with the pie slices values. - Parameter \a valuesRow specifies the row of the model. + Sets the model row that is kept in sync with the pie slices' values to \a valuesRow. */ void QHPieModelMapper::setValuesRow(int valuesRow) { @@ -225,7 +233,7 @@ void QHPieModelMapper::setValuesRow(int valuesRow) } /*! - Returns which row of the model is kept in sync with the labels of the pie's slices + Returns the row of the model that is kept in sync with the labels of the pie's slices. */ int QHPieModelMapper::labelsRow() const { @@ -233,8 +241,7 @@ int QHPieModelMapper::labelsRow() const } /*! - Sets the model row that is kept in sync with the pie's slices labels. - Parameter \a labelsRow specifies the row of the model. + Sets the model row that is kept in sync with the pie slices' labels to \a labelsRow. */ void QHPieModelMapper::setLabelsRow(int labelsRow) { diff --git a/src/charts/piechart/qvpiemodelmapper.cpp b/src/charts/piechart/qvpiemodelmapper.cpp index 21ba4966..9c0d8443 100644 --- a/src/charts/piechart/qvpiemodelmapper.cpp +++ b/src/charts/piechart/qvpiemodelmapper.cpp @@ -34,12 +34,15 @@ QT_CHARTS_BEGIN_NAMESPACE /*! \class QVPieModelMapper \inmodule Qt Charts - \brief Vertical model mapper for pie series. + \brief The QVPieModelMapper is a vertical model mapper for pie series. + + Model mappers enable using a data model derived from the QAbstractItemModel class + as a data source for a chart. A vertical model mapper is used to create a connection + between a data model and QPieSeries, so that each row in the data model defines a + pie slice and each column maps to the label or the value of the pie slice. - Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series. - Vertical model mapper is used to create a connection between QPieSeries and QAbstractItemModel derived model object that keeps the consecutive pie slices data in columns. - It is possible to use both QAbstractItemModel and QPieSeries model API. QVPieModelMapper makes sure that Pie and the model are kept in sync. - \note Used model has to support adding/removing rows/columns and modifying the data of the cells. + Both model and pie series properties can be used to manipulate the data. The model + mapper keeps the pie series and the data model in sync. */ /*! \qmltype VPieModelMapper @@ -48,12 +51,16 @@ QT_CHARTS_BEGIN_NAMESPACE \brief Vertical model mapper for pie series. - VPieModelMapper allows you to use your own QAbstractItemModel derived model with data in columns - as a data source for a pie series. It is possible to use both QAbstractItemModel and PieSeries - data API to manipulate data. VPieModelMapper keeps the Pie and the model in sync. + Model mappers enable using a data model derived from the QAbstractItemModel class + as a data source for a chart. A vertical model mapper is used to create a connection + between a data model and PieSeries, so that each row in the data model defines a + pie slice and each column maps to the label or the value of the pie slice. + + Both model and pie series properties can be used to manipulate the data. The model + mapper keeps the pie series and the data model in sync. - The following QML example would create a pie series with four slices (assuming the model has at - least five rows). Each slice would contain a label from column 1 and a value from column 2. + The following QML example creates a pie series with four slices (assuming the model has at + least five rows). Each slice gets a label from column 1 and a value from column 2. \code VPieModelMapper { series: pieSeries @@ -68,112 +75,115 @@ QT_CHARTS_BEGIN_NAMESPACE /*! \property QVPieModelMapper::series - \brief Defines the QPieSeries object that is used by the mapper. + \brief The pie series that is used by the mapper. + All the data in the series is discarded when it is set to the mapper. - When new series is specified the old series is disconnected (it preserves its data) + When a new series is specified, the old series is disconnected (but it preserves its data). */ /*! \qmlproperty PieSeries VPieModelMapper::series - Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a + The pie series that is used by the mapper. If you define the mapper element as a child for a PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper. - When new series is specified the old series is disconnected (it preserves its data). + When new series is specified the old series is disconnected (but it preserves its data). */ /*! \property QVPieModelMapper::model - \brief Defines the model that is used by the mapper. + \brief The model that is used by the mapper. */ /*! \qmlproperty SomeModel VPieModelMapper::model The QAbstractItemModel based model that is used by the mapper. You need to implement the model - and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying - the data of the cells. + and expose it to QML. + + \note The model has to support adding and removing rows or columns and modifying + the data in the cells. */ /*! \property QVPieModelMapper::valuesColumn - \brief Defines which column of the model is kept in sync with the values of the pie's slices. + \brief The column of the model that is kept in sync with the values of the pie's slices. - Default value is: -1 (invalid mapping) + The default value is -1 (invalid mapping). */ /*! \qmlproperty int VPieModelMapper::valuesColumn - Defines which column of the model is kept in sync with the values of the pie's slices. Default value is -1 (invalid - mapping). + The column of the model that is kept in sync with the values of the pie's slices. + The default value is -1 (invalid mapping). */ /*! \property QVPieModelMapper::labelsColumn - \brief Defines which column of the model is kept in sync with the labels of the pie's slices. + \brief The column of the model that is kept in sync with the labels of the pie's slices. - Default value is: -1 (invalid mapping) + The default value is -1 (invalid mapping). */ /*! \qmlproperty int VPieModelMapper::labelsColumn - Defines which column of the model is kept in sync with the labels of the pie's slices. Default value is -1 (invalid - mapping). + The column of the model that is kept in sync with the labels of the pie's slices. + The default value is -1 (invalid mapping). */ /*! \property QVPieModelMapper::firstRow - \brief Defines which row of the model contains the first slice value. + \brief The row of the model that contains the first slice value. - Minimal and default value is: 0 + The minimum and default value is 0. */ /*! \qmlproperty int VPieModelMapper::firstRow - Defines which row of the model contains the first slice value. + The row of the model that contains the first slice value. The default value is 0. */ /*! \property QVPieModelMapper::rowCount - \brief Defines the number of rows of the model that are mapped as the data for QPieSeries. + \brief The number of rows of the model that are mapped as the data for a pie series. - Minimal and default value is: -1 (count limited by the number of rows in the model) + The minimum and default value is -1 (number limited by the number of rows in the model). */ /*! \qmlproperty int VPieModelMapper::columnCount - Defines the number of rows of the model that are mapped as the data for QPieSeries. The default value is - -1 (count limited by the number of rows in the model) + The number of rows of the model that are mapped as the data for a pie series. + The default value is -1 (number limited by the number of rows in the model). */ /*! \fn void QVPieModelMapper::seriesReplaced() - Emitted when the series to which mapper is connected to has changed. + This signal is emitted when the series that the mapper is connected to changes. */ /*! \fn void QVPieModelMapper::modelReplaced() - Emitted when the model to which mapper is connected to has changed. + This signal is emitted when the model that the mapper is connected to changes. */ /*! \fn void QVPieModelMapper::valuesColumnChanged() - Emitted when the valuesColumn has changed. + This signal is emitted when the values column changes. */ /*! \fn void QVPieModelMapper::labelsColumnChanged() - Emitted when the labelsColumn has changed. + This signal is emitted when the labels column changes. */ /*! \fn void QVPieModelMapper::firstRowChanged() - Emitted when the firstRow has changed. + This signal is emitted when the first row changes. */ /*! \fn void QVPieModelMapper::rowCountChanged() - Emitted when the rowCount has changed. + This signal is emitted when the number of rows changes. */ /*! - Constructs a mapper object which is a child of \a parent. + Constructs a mapper object that is a child of \a parent. */ QVPieModelMapper::QVPieModelMapper(QObject *parent) : QPieModelMapper(parent) @@ -208,7 +218,7 @@ void QVPieModelMapper::setSeries(QPieSeries *series) } /*! - Returns which column of the model is kept in sync with the values of the pie's slices + Returns the column of the model that is kept in sync with the values of the pie's slices. */ int QVPieModelMapper::valuesColumn() const { @@ -216,8 +226,7 @@ int QVPieModelMapper::valuesColumn() const } /*! - Sets the model column that is kept in sync with the pie slices values. - Parameter \a valuesColumn specifies the row of the model. + Sets the model column that is kept in sync with the pie slices' values to \a valuesColumn. */ void QVPieModelMapper::setValuesColumn(int valuesColumn) { @@ -228,7 +237,7 @@ void QVPieModelMapper::setValuesColumn(int valuesColumn) } /*! - Returns which column of the model is kept in sync with the labels of the pie's slices + Returns the column of the model that is kept in sync with the labels of the pie's slices. */ int QVPieModelMapper::labelsColumn() const { @@ -236,8 +245,7 @@ int QVPieModelMapper::labelsColumn() const } /*! - Sets the model column that is kept in sync with the pie's slices labels. - Parameter \a labelsColumn specifies the row of the model. + Sets the model column that is kept in sync with the pies slices' labels to \a labelsColumn. */ void QVPieModelMapper::setLabelsColumn(int labelsColumn) { -- cgit v1.2.3