From ca99ef5d7b001a7aaf4dd8e3e5be1994e565012e 2012-06-18 13:06:43 From: Tero Ahola Date: 2012-06-18 13:06:43 Subject: [PATCH] Documenting QML bar series API --- diff --git a/plugins/declarative/declarativebarseries.cpp b/plugins/declarative/declarativebarseries.cpp index 3a2f555..ca43528 100644 --- a/plugins/declarative/declarativebarseries.cpp +++ b/plugins/declarative/declarativebarseries.cpp @@ -26,62 +26,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE -/*! - \qmlclass BarSeries QBarSeries - - \section1 Example Usage - - \beginfloatleft - \image demos_qmlchart6.png - \endfloat - \clearfloat - - The following QML shows how to create a simple bar chart: - \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1 -*/ - -/*! - \qmlclass GroupedBarSeries QGroupedBarSeries - - \section1 Example Usage - - \beginfloatleft - \image demos_qmlchart7.png - \endfloat - \clearfloat - - The following QML shows how to create a simple grouped bar chart: - \snippet ../demos/qmlchart/qml/qmlchart/View7.qml 1 -*/ - -/*! - \qmlclass StackedBarSeries QStackedBarSeries - - \section1 Example Usage - - \beginfloatleft - \image demos_qmlchart8.png - \endfloat - \clearfloat - - The following QML shows how to create a simple stacked bar chart: - \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 -*/ - -/*! - \qmlclass PercentBarSeries QPercentBarSeries - - \section1 Example Usage - - \beginfloatleft - \image demos_qmlchart9.png - \endfloat - \clearfloat - - The following QML shows how to create a simple percent bar chart: - \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1 -*/ - DeclarativeBarSet::DeclarativeBarSet(QObject *parent) : QBarSet("", parent) { diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp index 1fa7f7c..1280dca 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/qbarseries.cpp @@ -45,26 +45,50 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \sa QBarSet, QStackedBarSeries, QPercentBarSeries */ +/*! + \qmlclass BarSeries QBarSeries + + \beginfloatleft + \image demos_qmlchart6.png + \endfloat + \clearfloat + + The following QML shows how to create a simple bar chart: + \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1 +*/ /*! \property QBarSeries::barWidth - \brief The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars + The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. - Note that with QGroupedBarSeries this value means the width of one group of bars instead of just one bar. This is - because with grouped series it is more logical to set width of whole group and let the chart calculate correct - width for bar. + Note that with QGroupedBarSeries this value means the width of one group of bars instead of just one bar. \sa QGroupedBarSeries */ +/*! + \qmlproperty real BarSeries::barWidth + The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars + is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen + is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. + Note that with QGroupedBarSeries this value means the width of one group of bars instead of just one bar. +*/ /*! \property QBarSeries::count - \brief Holds the number of sets in series. + Holds the number of sets in series. +*/ +/*! + \qmlproperty int BarSeries::count + Holds the number of sets in series. */ /*! \property QBarSeries::labelsVisible - \brief Defines the visibility of the labels in series + Defines the visibility of the labels in series +*/ +/*! + \qmlproperty bool BarSeries::labelsVisible + Defines the visibility of the labels in series */ /*! @@ -73,6 +97,12 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset. Clicked bar inside set is indexed by \a index */ +/*! + \qmlsignal BarSeries::onClicked(BarSet barset, int index) + + The signal is emitted if the user clicks with a mouse on top of BarSet. + Clicked bar inside set is indexed by \a index +*/ /*! \fn void QBarSeries::hovered(QBarSet* barset, bool status) @@ -81,34 +111,38 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE Parameter \a barset is the pointer of barset, where hover happened. Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. */ +/*! + \qmlsignal BarSeries::onHovered(BarSet barset, bool status) + + The signal is emitted if mouse is hovered on top of series. + Parameter \a barset is the pointer of barset, where hover happened. + Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. +*/ /*! \fn void QBarSeries::countChanged() - + This signal is emitted when barset count has been changed, for example by append or remove. +*/ +/*! + \qmlsignal BarSeries::countChanged() This signal is emitted when barset count has been changed, for example by append or remove. */ /*! \fn void QBarSeries::labelsVisibleChanged() - - This signal is emitted when labels visibility have changed. - + This signal is emitted when labels visibility have changed. \sa isLabelsVisible(), setLabelsVisible() */ /*! \fn void QBarSeries::barsetsAdded(QList sets) - This signal is emitted when \a sets have been added to the series. - \sa append(), insert() */ /*! \fn void QBarSeries::barsetsRemoved(QList sets) - This signal is emitted when \a sets have been removed from the series. - \sa remove() */ diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index 0d87d1a..88672b6 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -36,10 +36,23 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \sa QBarSeries, QGroupedBarSeries, QStackedBarSeries, QPercentBarSeries */ +/*! + \qmlclass BarSet QBarSet + + BarSet represents one set of bars. Set of bars contains one data value for each category. + First value of set is assumed to belong to first category, second to second category and so on. + If set has fewer values than there are categories, then the missing values are assumed to be + at the end of set. For missing values in middle of a set, numerical value of zero is used. + \sa BarSeries, GroupedBarSeries, StackedBarSeries, PercentBarSeries +*/ /*! \property QBarSet::label - \brief Defines the label of the barSet. + Defines the label of the barSet. +*/ +/*! + \qmlproperty string BarSet::label + Defines the label of the barSet. */ /*! @@ -64,56 +77,58 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! \property QBarSet::color - \brief The fill (brush) color of the bar set. + The fill (brush) color of the bar set. +*/ +/*! + \qmlproperty color BarSet::color + The fill (brush) color of the bar set. */ /*! \property QBarSet::borderColor - \brief The line (pen) color of the bar set. + The line (pen) color of the bar set. +*/ +/*! + \qmlproperty color BarSet::borderColor + The line (pen) color of the bar set. */ /*! \property QBarSet::labelColor - \brief The text (label) color of the bar set. + The text (label) color of the bar set. +*/ +/*! + \qmlproperty color BarSet::labelColor + The text (label) color of the bar set. */ /*! \fn void QBarSet::labelChanged() - This signal is emitted when the label of the barSet has changed. - \sa label */ /*! \fn void QBarSet::penChanged() - This signal is emitted when the pen of the barSet has changed. - \sa pen */ /*! \fn void QBarSet::brushChanged() - This signal is emitted when the brush of the barSet has changed. - \sa brush */ /*! \fn void QBarSet::labelBrushChanged() - This signal is emitted when the brush of the barSet's label has changed. - \sa labelBrush */ /*! \fn void QBarSet::labelFontChanged() - This signal is emitted when the font of the barSet's label has changed. - \sa labelBrush */ @@ -121,46 +136,68 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \fn void QBarSet::colorChanged(QColor) This signal is emitted when the fill (brush) color of the set has changed to \a color. */ +/*! + \qmlsignal BarSet::onColorChanged(color color) + This signal is emitted when the fill (brush) color of the set has changed to \a color. +*/ /*! \fn void QBarSet::borderColorChanged(QColor) This signal is emitted when the line (pen) color of the set has changed to \a color. */ +/*! + \qmlsignal BarSet::onBorderColorChanged(color color) + This signal is emitted when the line (pen) color of the set has changed to \a color. +*/ /*! \fn void QBarSet::labelColorChanged(QColor) This signal is emitted when the text (label) color of the set has changed to \a color. */ +/*! + \qmlsignal BarSet::onLabelColorChanged(color color) + This signal is emitted when the text (label) color of the set has changed to \a color. +*/ /*! \fn void QBarSet::valuesAdded(int index, int count) - This signal is emitted when new values have been added to the set. Parameter \a index indicates the position of the first inserted value. Parameter \a count is the number of iserted values. - \sa append(), insert() */ +/*! + \qmlsignal BarSet::onValuesAdded(int index, int count) + This signal is emitted when new values have been added to the set. + Parameter \a index indicates the position of the first inserted value. + Parameter \a count is the number of iserted values. +*/ /*! \fn void QBarSet::valuesRemoved(int index, int count) - This signal is emitted values have been removed from the set. Parameter \a index indicates the position of the first removed value. Parameter \a count is the number of removed values. - \sa remove() */ +/*! + \qmlsignal BarSet::onValuesRemoved(int index, int count) + This signal is emitted values have been removed from the set. + Parameter \a index indicates the position of the first removed value. + Parameter \a count is the number of removed values. +*/ /*! \fn void QBarSet::valueChanged(int index) - This signal is emitted values the value in the set has been modified. Parameter \a index indicates the position of the modified value. - \sa at() */ -void valueChanged(int index); +/*! + \qmlsignal BarSet::onValueChanged(int index) + This signal is emitted values the value in the set has been modified. + Parameter \a index indicates the position of the modified value. +*/ /*! Constructs QBarSet with a label of \a label and with parent of \a parent diff --git a/src/barchart/qgroupedbarseries.cpp b/src/barchart/qgroupedbarseries.cpp index dab9241..db247cb 100644 --- a/src/barchart/qgroupedbarseries.cpp +++ b/src/barchart/qgroupedbarseries.cpp @@ -41,6 +41,17 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \sa QBarSet, QPercentBarSeries, QBarSeries, QStackedBarSeries */ +/*! + \qmlclass GroupedBarSeries QGroupedBarSeries + \inherits BarSeries + + The following QML shows how to create a simple grouped bar chart: + \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 + \beginfloatleft + \image demos_qmlchart7.png + \endfloat + \clearfloat +*/ /*! Constructs empty QGroupedBarSeries. diff --git a/src/barchart/qpercentbarseries.cpp b/src/barchart/qpercentbarseries.cpp index 2e0276e..d014d90 100644 --- a/src/barchart/qpercentbarseries.cpp +++ b/src/barchart/qpercentbarseries.cpp @@ -41,6 +41,17 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE \sa QBarSet, QStackedBarSeries, QBarSeries */ +/*! + \qmlclass PercentBarSeries QPercentBarSeries + \inherits BarSeries + + The following QML shows how to create a simple percent bar chart: + \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1 + \beginfloatleft + \image demos_qmlchart9.png + \endfloat + \clearfloat +*/ /*! Constructs empty QPercentBarSeries. diff --git a/src/barchart/qstackedbarseries.cpp b/src/barchart/qstackedbarseries.cpp index c7c89b1..f7728f8 100644 --- a/src/barchart/qstackedbarseries.cpp +++ b/src/barchart/qstackedbarseries.cpp @@ -43,6 +43,18 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \qmlclass StackedBarSeries QStackedBarSeries + \inherits BarSeries + + The following QML shows how to create a simple stacked bar chart: + \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 + \beginfloatleft + \image demos_qmlchart8.png + \endfloat + \clearfloat +*/ + +/*! Constructs empty QStackedBarSeries. QStackedBarSeries is QObject which is a child of a \a parent. */ diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml index 59f8434..518737c 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml @@ -33,6 +33,8 @@ ChartView { BarSeries { id: daSeries name: "bar" + onClicked: console.log("onClicked: " + barset + " " + index); + onHovered: console.log("onHovered: " + barset + " " + status); BarSet { label: "Bob"; values: [4, 7, 3, 10, 5, 6] } BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 8] } BarSet { label: "James"; values: [3, 5, 8, 5, 4, 7] } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/GroupedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/GroupedBarChart.qml index 9e50876..a0c6c0c 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/GroupedBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/GroupedBarChart.qml @@ -33,6 +33,8 @@ ChartView { GroupedBarSeries { id: daSeries name: "bar" + onClicked: console.log("onClicked: " + barset + " " + index); + onHovered: console.log("onHovered: " + barset + " " + status); BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml index ccdbc50..5baecb4 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml @@ -33,6 +33,8 @@ ChartView { PercentBarSeries { id: daSeries name: "bar" + onClicked: console.log("onClicked: " + barset + " " + index); + onHovered: console.log("onHovered: " + barset + " " + status); BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml index 4d82623..2a49732 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml @@ -31,7 +31,7 @@ ChartView { PieSeries { id: pieSeries name: "pie" - PieSlice { id: daSlice; label: "slice1"; value: 11 } + PieSlice { label: "slice1"; value: 11 } PieSlice { label: "slice2"; value: 22 } PieSlice { label: "slice3"; value: 33 } } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml index 0e44f68..aed0047 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml @@ -33,6 +33,8 @@ ChartView { StackedBarSeries { id: daSeries name: "bar" + onClicked: console.log("onClicked: " + barset + " " + index); + onHovered: console.log("onHovered: " + barset + " " + status); BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }