##// END OF EJS Templates
Doc: Use a standard documentation config for a Qt module...
Doc: Use a standard documentation config for a Qt module - Rename index.html to qtcharts-index.html - Use the qt-module-defaults global doc template - Convert 'indexes' into 'depends' - Remove custom buildversion string - Remove Q_INVOKABLE as ignore token, it's already listed in the global config - Use a namespace consistent with the rest of Qt modules - Update examplesinstallpath to the changes introduced in Qt 5.6 packaging. - Remove unnecessary \keyword on the landing page, as it may conflict with other modules' docs. Change-Id: I5cc0ff026b02bae22a415d82e36cb945bd19ae53 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>

File last commit:

r2854:46147b040d06
r2862:b8bfb31b9099
Show More
qbarset.cpp
699 lines | 17.5 KiB | text/x-c | CppLexer
Miikka Heikkinen
Updated license...
r2854 /****************************************************************************
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** This file is part of the Qt Charts module of the Qt Toolkit.
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** $QT_BEGIN_LICENSE:GPL$
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
Miikka Heikkinen
Updated license...
r2854 ** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
Miikka Heikkinen
Updated license...
r2854 ****************************************************************************/
Jani Honkonen
Add license headers
r794
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QBarSet>
#include <private/qbarset_p.h>
#include <private/charthelpers_p.h>
#include <private/qchart_p.h>
sauimone
proof of concept implementation for barset and barcategory
r169
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
sauimone
proof of concept implementation for barset and barcategory
r169
sauimone
Documentation for bar charts
r313 /*!
\class QBarSet
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Building block for different bar charts.
sauimone
Documentation for bar charts
r313
QBarSet 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.
Titta Heikkala
Fixed bar label visibility...
r2814 Labels for zero value sets are not shown.
sauimone
Documentation for bar charts
r313
sauimone
GroupedBarSeries to BarSeries
r1594 \sa QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries
sauimone
Documentation for bar charts
r313 */
Titta Heikkala
Fix Charts documentation...
r2639 /*!
\qmltype BarSet
\instantiates QBarSet
Titta Heikkala
Qt Charts project file structure change...
r2712 \inqmlmodule QtCharts
Titta Heikkala
Fix Charts documentation...
r2639
Titta Heikkala
Qt Charts project file structure change...
r2712 \brief Building block for different bar charts.
Tero Ahola
Documenting QML bar series API
r1489
Titta Heikkala
Qt Charts project file structure change...
r2712 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.
Titta Heikkala
Fixed bar label visibility...
r2814 Labels for zero value sets are not shown.
Titta Heikkala
Qt Charts project file structure change...
r2712 \sa AbstractBarSeries, BarSeries, StackedBarSeries, PercentBarSeries
Tero Ahola
Documenting QML bar series API
r1489 */
sauimone
Documentation for bar charts
r313
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 \property QBarSet::label
Miikka Heikkinen
Fix some documentation issues...
r2520 Defines the label of the bar set.
Tero Ahola
Documenting QML bar series API
r1489 */
/*!
\qmlproperty string BarSet::label
Miikka Heikkinen
Fix some documentation issues...
r2520 Defines the label of the bar set.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
\property QBarSet::pen
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Defines the pen used by the bar set.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
\property QBarSet::brush
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Defines the brush used by the bar set.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 /*!
\qmlproperty QString BarSet::brushFilename
The name of the file used as a brush for the set.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
\property QBarSet::labelBrush
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Defines the brush used by the bar set's label.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
\property QBarSet::labelFont
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Defines the font used by the bar set's label.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Jani Honkonen
Add qml Font properties & docs
r1517 /*!
\qmlproperty Font BarSet::labelFont
Miikka Heikkinen
Fix some documentation issues...
r2520 Defines the font used by the bar set's label.
Jani Honkonen
Add qml Font properties & docs
r1517
Titta Heikkala
Fix Charts documentation...
r2639 See the Qt documentation for more details of Font.
Jani Honkonen
Add qml Font properties & docs
r1517 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 /*!
\property QBarSet::color
Tero Ahola
Documenting QML bar series API
r1489 The fill (brush) color of the bar set.
*/
/*!
\qmlproperty color BarSet::color
The fill (brush) color of the bar set.
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 */
/*!
\property QBarSet::borderColor
Tero Ahola
Documenting QML bar series API
r1489 The line (pen) color of the bar set.
*/
/*!
\qmlproperty color BarSet::borderColor
The line (pen) color of the bar set.
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 */
Tero Ahola
Adding missing QML series API line/border properties
r1904 /*!
\qmlproperty real BarSet::borderWidth
The width of the border line. By default the width is 2.0.
*/
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 /*!
\property QBarSet::labelColor
Tero Ahola
Documenting QML bar series API
r1489 The text (label) color of the bar set.
*/
/*!
\qmlproperty color BarSet::labelColor
The text (label) color of the bar set.
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 */
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 /*!
\fn void QBarSet::clicked(int index)
Miikka Heikkinen
Fix some documentation issues...
r2520 The signal is emitted if the user clicks with a mouse on top of bar set.
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 Clicked bar inside set is indexed by \a index
*/
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 /*!
\fn void QBarSet::pressed(int index)
The signal is emitted if the user presses with a mouse on top of bar set.
Pressed bar inside set is indexed by \a index
*/
/*!
\fn void QBarSet::released(int index)
The signal is emitted if the user releases with a mouse on top of bar set.
Released bar inside set is indexed by \a index
*/
/*!
\fn void QBarSet::doubleClicked(int index)
The signal is emitted if the user doubleclicks with a mouse on top of bar set.
Doubleclicked bar inside set is indexed by \a index
*/
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 /*!
\fn void QBarSet::hovered(bool status, int index)
The signal is emitted if mouse is hovered on top of bar set.
Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
Hovered bar inside the set is indexed by \a index.
*/
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 \fn void QBarSet::labelChanged()
Miikka Heikkinen
Fix some documentation issues...
r2520 This signal is emitted when the label of the bar set has changed.
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 \sa label
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Tero Ahola
QML signals documentation
r1531 /*!
\qmlsignal BarSet::onLabelChanged()
Miikka Heikkinen
Fix some documentation issues...
r2520 This signal is emitted when the label of the bar set has changed.
Tero Ahola
QML signals documentation
r1531 */
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
\fn void QBarSet::penChanged()
Miikka Heikkinen
Fix some documentation issues...
r2520 This signal is emitted when the pen of the bar set has changed.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 \sa pen
*/
/*!
\fn void QBarSet::brushChanged()
Miikka Heikkinen
Fix some documentation issues...
r2520 This signal is emitted when the brush of the bar set has changed.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 \sa brush
*/
/*!
\fn void QBarSet::labelBrushChanged()
Miikka Heikkinen
Fix some documentation issues...
r2520 This signal is emitted when the brush of the bar set's label has changed.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 \sa labelBrush
*/
/*!
\fn void QBarSet::labelFontChanged()
Miikka Heikkinen
Fix some documentation issues...
r2520 This signal is emitted when the font of the bar set's label has changed.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 \sa labelBrush
*/
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 /*!
\fn void QBarSet::colorChanged(QColor)
This signal is emitted when the fill (brush) color of the set has changed to \a color.
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlsignal BarSet::onColorChanged(color color)
This signal is emitted when the fill (brush) color of the set has changed to \a color.
*/
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465
/*!
\fn void QBarSet::borderColorChanged(QColor)
This signal is emitted when the line (pen) color of the set has changed to \a color.
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlsignal BarSet::onBorderColorChanged(color color)
This signal is emitted when the line (pen) color of the set has changed to \a color.
*/
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465
/*!
\fn void QBarSet::labelColorChanged(QColor)
This signal is emitted when the text (label) color of the set has changed to \a color.
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlsignal BarSet::onLabelColorChanged(color color)
This signal is emitted when the text (label) color of the set has changed to \a color.
*/
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
\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.
Miikka Heikkinen
Documentation updates...
r2494 Parameter \a count is the number of inserted values.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 \sa append(), insert()
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\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.
Miikka Heikkinen
Documentation updates...
r2494 Parameter \a count is the number of inserted values.
Tero Ahola
Documenting QML bar series API
r1489 */
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
\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()
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\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.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
\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()
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\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.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
Tero Ahola
Document fixes to QML BarSet
r1523 /*!
\qmlproperty int BarSet::count
Miikka Heikkinen
Fix some documentation issues...
r2520 The count of values on the bar set
Tero Ahola
Document fixes to QML BarSet
r1523 */
/*!
\qmlproperty QVariantList BarSet::values
Miikka Heikkinen
Fix some documentation issues...
r2520 The values of the bar set. You can set either a list of reals or a list of points as values. If you set a list of
Tero Ahola
Document fixes to QML BarSet
r1523 reals as values, the values are automatically completed to points by using the index of a value as it's
Titta Heikkala
Fix setting values for BarSet using Qt.point...
r2678 x-coordinate. For example the following sets have equal values:
Tero Ahola
Document fixes to QML BarSet
r1523 \code
myBarSet1.values = [0, 5, 1, 5];
Titta Heikkala
Fix setting values for BarSet using Qt.point...
r2678 myBarSet2.values = [Qt.point(0, 0), Qt.point(1, 5), Qt.point(2, 1), Qt.point(3, 5)];
Tero Ahola
Document fixes to QML BarSet
r1523 \endcode
*/
sauimone
Documentation for bar charts
r313 /*!
Miikka Heikkinen
Documentation updates...
r2494 Constructs QBarSet with a label of \a label and with parent of \a parent.
sauimone
Documentation for bar charts
r313 */
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 QBarSet::QBarSet(const QString label, QObject *parent)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QObject(parent),
d_ptr(new QBarSetPrivate(label, this))
sauimone
proof of concept implementation for barset and barcategory
r169 {
}
sauimone
barchart: doc update for hover signals
r980 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Destroys the bar set.
sauimone
barchart: doc update for hover signals
r980 */
Jani Honkonen
Fix vs build problems with bar
r944 QBarSet::~QBarSet()
{
sauimone
barchart: doc update for hover signals
r980 // NOTE: d_ptr destroyed by QObject
Jani Honkonen
Fix vs build problems with bar
r944 }
sauimone
Documentation for bar charts
r313 /*!
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 Sets new \a label for set.
sauimone
Documentation for bar charts
r313 */
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 void QBarSet::setLabel(const QString label)
sauimone
proof of concept implementation for barset and barcategory
r169 {
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 d_ptr->m_label = label;
emit labelChanged();
sauimone
proof of concept implementation for barset and barcategory
r169 }
sauimone
Documentation for bar charts
r313
/*!
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 Returns label of the set.
sauimone
Documentation for bar charts
r313 */
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 QString QBarSet::label() const
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 return d_ptr->m_label;
sauimone
Barset and barcategory implememtation. Updated test application
r171 }
sauimone
proof of concept implementation for barset and barcategory
r169
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 /*!
sauimone
Removed QPointF from QBarSet
r1580 Appends new value \a value to the end of set.
sauimone
Documentation for bar charts
r313 */
sauimone
barset: unified insert/set/remove methods
r993 void QBarSet::append(const qreal value)
sauimone
proof of concept implementation for barset and barcategory
r169 {
sauimone
Removed QPointF from QBarSet
r1580 // Convert to QPointF
sauimone
fixed barseries examples, fixed qbarset << operator
r1601 int index = d_ptr->m_values.count();
sauimone
Removed QPointF from QBarSet
r1580 d_ptr->append(QPointF(d_ptr->m_values.count(), value));
Marek Rosa
minor fix
r1602 emit valuesAdded(index, 1);
sauimone
new series: groupedbarseries
r1167 }
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 /*!
Marek Rosa
Docs update for BarSeries and BarSet
r1361 Appends a list of reals to set. Works like append with single real value. The \a values in list
Miikka Heikkinen
Fix some documentation issues...
r2520 are appended to end of bar set.
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 \sa append()
*/
sauimone
barset append list changed to take reference
r1500 void QBarSet::append(const QList<qreal> &values)
sauimone
new series: groupedbarseries
r1167 {
int index = d_ptr->m_values.count();
sauimone
barchart signals for properties and changes
r1353 d_ptr->append(values);
emit valuesAdded(index, values.count());
sauimone
barset: unified insert/set/remove methods
r993 }
/*!
Jani Honkonen
Fix some spelling errors
r1932 Convenience operator. Same as append, with real \a value.
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 \sa append()
sauimone
barset: unified insert/set/remove methods
r993 */
Jani Honkonen
more coding style fixes for src-folder...
r2104 QBarSet &QBarSet::operator << (const qreal &value)
sauimone
barset: unified insert/set/remove methods
r993 {
sauimone
fixed barseries examples, fixed qbarset << operator
r1601 append(value);
sauimone
new series: groupedbarseries
r1167 return *this;
}
Marek Rosa
Updated spline chart example documentation and added some more docs to barseries
r901 /*!
sauimone
barset: unified insert/set/remove methods
r993 Inserts new \a value on the \a index position.
Miikka Heikkinen
Documentation updates...
r2494 The value that is currently at this postion is moved to position index + 1
sauimone
barset: unified insert/set/remove methods
r993 \sa remove()
Marek Rosa
Updated spline chart example documentation and added some more docs to barseries
r901 */
sauimone
barset: unified insert/set/remove methods
r993 void QBarSet::insert(const int index, const qreal value)
Marek Rosa
Adding data to BarSet through model added
r662 {
sauimone
barchart signals for properties and changes
r1353 d_ptr->insert(index, value);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 emit valuesAdded(index, 1);
sauimone
barchart signals for properties and changes
r1353 }
Marek Rosa
Updated spline chart example documentation and added some more docs to barseries
r901 /*!
Marek Rosa
Docs update for BarSeries and BarSet
r1361 Removes \a count number of values from the set starting at \a index.
sauimone
barset: unified insert/set/remove methods
r993 \sa insert()
Marek Rosa
Updated spline chart example documentation and added some more docs to barseries
r901 */
sauimone
barset: removed boolean return value from remove(index,count) function
r1514 void QBarSet::remove(const int index, const int count)
Marek Rosa
Removing data from BarSeries through model added
r663 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 int removedCount = d_ptr->remove(index, count);
if (removedCount > 0)
emit valuesRemoved(index, removedCount);
sauimone
barset: removed boolean return value from remove(index,count) function
r1514 return;
Marek Rosa
Removing data from BarSeries through model added
r663 }
sauimone
Documentation for bar charts
r313 /*!
Miikka Heikkinen
Documentation updates...
r2494 Sets a new value \a value to set, indexed by \a index.
sauimone
Documentation for bar charts
r313 */
sauimone
barset: unified insert/set/remove methods
r993 void QBarSet::replace(const int index, const qreal value)
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
Tero Ahola
Parameter validation for QBarSet::replace and remove
r1512 if (index >= 0 && index < d_ptr->m_values.count()) {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 d_ptr->replace(index, value);
Tero Ahola
Parameter validation for QBarSet::replace and remove
r1512 emit valueChanged(index);
}
sauimone
barchart signals for properties and changes
r1353 }
sauimone
Barset and barcategory implememtation. Updated test application
r171
sauimone
Documentation for bar charts
r313 /*!
sauimone
Removed QPointF from QBarSet
r1580 Returns value of set indexed by \a index.
If the index is out of bounds 0.0 is returned.
sauimone
Documentation for bar charts
r313 */
sauimone
Removed QPointF from QBarSet
r1580 qreal QBarSet::at(const int index) const
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (index < 0 || index >= d_ptr->m_values.count())
sauimone
Removed QPointF from QBarSet
r1580 return 0;
return d_ptr->m_values.at(index).y();
sauimone
Barset and barcategory implememtation. Updated test application
r171 }
sauimone
Documentation for bar charts
r313 /*!
sauimone
Removed QPointF from QBarSet
r1580 Returns value of set indexed by \a index.
If the index is out of bounds 0.0 is returned.
sauimone
Documentation for bar charts
r313 */
sauimone
Removed QPointF from QBarSet
r1580 qreal QBarSet::operator [](const int index) const
sauimone
brush support for bargroups
r183 {
sauimone
Removed QPointF from QBarSet
r1580 return at(index);
sauimone
barset: unified insert/set/remove methods
r993 }
/*!
Returns count of values in set.
*/
int QBarSet::count() const
{
return d_ptr->m_values.count();
sauimone
brush support for bargroups
r183 }
sauimone
fixed example paths in barchart documentation
r492 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns sum of all values in the bar set.
sauimone
fixed example paths in barchart documentation
r492 */
sauimone
barchart pimpl part 1
r934 qreal QBarSet::sum() const
sauimone
updating drilldown example. Needs some more thinking
r438 {
qreal total(0);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < d_ptr->m_values.count(); i++)
sauimone
new series: groupedbarseries
r1167 total += d_ptr->m_values.at(i).y();
sauimone
updating drilldown example. Needs some more thinking
r438 return total;
}
sauimone
Documentation for bar charts
r313 /*!
Sets pen for set. Bars of this set are drawn using \a pen
*/
sauimone
minor code review fixes, part n
r763 void QBarSet::setPen(const QPen &pen)
sauimone
Added pen & brush to QBarSet
r214 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (d_ptr->m_pen != pen) {
d_ptr->m_pen = pen;
emit d_ptr->updatedBars();
emit penChanged();
}
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
Documentation for bar charts
r313 /*!
Returns pen of the set.
*/
sauimone
Fixed layout for barcharts
r473 QPen QBarSet::pen() const
sauimone
Added pen & brush to QBarSet
r214 {
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (d_ptr->m_pen == QChartPrivate::defaultPen())
return QPen();
else
return d_ptr->m_pen;
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
Documentation for bar charts
r313 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Sets brush for the set. Bars of this set are drawn using \a brush.
sauimone
Documentation for bar charts
r313 */
sauimone
minor code review fixes, part n
r763 void QBarSet::setBrush(const QBrush &brush)
sauimone
Added pen & brush to QBarSet
r214 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (d_ptr->m_brush != brush) {
d_ptr->m_brush = brush;
emit d_ptr->updatedBars();
emit brushChanged();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
Documentation for bar charts
r313 /*!
Returns brush of the set.
*/
sauimone
Fixed layout for barcharts
r473 QBrush QBarSet::brush() const
sauimone
Added pen & brush to QBarSet
r214 {
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (d_ptr->m_brush == QChartPrivate::defaultBrush())
return QBrush();
else
return d_ptr->m_brush;
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Sets \a brush of the values that are drawn on top of this bar set.
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 */
void QBarSet::setLabelBrush(const QBrush &brush)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (d_ptr->m_labelBrush != brush) {
Michal Klocek
Adds big fat pimpl to series classes...
r938 d_ptr->m_labelBrush = brush;
sauimone
barchart: removed mousebuttons from clicked signal. removed selected signal. unified internal signal naming in barset and barseries private
r1008 emit d_ptr->updatedBars();
sauimone
barchart signals for properties and changes
r1353 emit labelBrushChanged();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 }
/*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns brush of the values that are drawn on top of this bar set.
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 */
QBrush QBarSet::labelBrush() const
{
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush())
return QBrush();
else
return d_ptr->m_labelBrush;
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 }
/*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Sets the \a font for values that are drawn on top of this bar set.
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 */
void QBarSet::setLabelFont(const QFont &font)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (d_ptr->m_labelFont != font) {
Michal Klocek
Adds big fat pimpl to series classes...
r938 d_ptr->m_labelFont = font;
sauimone
barchart: removed mousebuttons from clicked signal. removed selected signal. unified internal signal naming in barset and barseries private
r1008 emit d_ptr->updatedBars();
sauimone
barchart signals for properties and changes
r1353 emit labelFontChanged();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
better use of gradients in barcharts
r512 }
/*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns the pen for values that are drawn on top of this bar set.
sauimone
better use of gradients in barcharts
r512 */
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 QFont QBarSet::labelFont() const
sauimone
better use of gradients in barcharts
r512 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_labelFont;
sauimone
better use of gradients in barcharts
r512 }
sauimone
updated documentation for barseries
r1493 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns the color of the brush of bar set.
sauimone
updated documentation for barseries
r1493 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 QColor QBarSet::color()
{
return brush().color();
}
sauimone
updated documentation for barseries
r1493 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Sets the \a color of brush for this bar set.
sauimone
updated documentation for barseries
r1493 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 void QBarSet::setColor(QColor color)
{
QBrush b = brush();
sauimone
fix to QTRD-1519:Setting color for a BarSet has no effect. Theme was overriding the color, which was defined on QML side
r1788 if ((b.color() != color) || (b.style() == Qt::NoBrush)) {
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 b.setColor(color);
sauimone
fix to QTRD-1519:Setting color for a BarSet has no effect. Theme was overriding the color, which was defined on QML side
r1788 if (b.style() == Qt::NoBrush) {
// Set tyle to Qt::SolidPattern. (Default is Qt::NoBrush)
// This prevents theme to override color defined in QML side:
// BarSet { label: "Bob"; color:"red"; values: [1,2,3] }
// The color must be obeyed, since user wanted it.
b.setStyle(Qt::SolidPattern);
}
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 setBrush(b);
emit colorChanged(color);
}
}
sauimone
updated documentation for barseries
r1493 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns the color of pen of this bar set.
sauimone
updated documentation for barseries
r1493 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 QColor QBarSet::borderColor()
{
return pen().color();
}
sauimone
updated documentation for barseries
r1493 /*!
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 Sets the \a color of pen for this bar set.
sauimone
updated documentation for barseries
r1493 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 void QBarSet::setBorderColor(QColor color)
{
QPen p = pen();
if (p.color() != color) {
p.setColor(color);
setPen(p);
emit borderColorChanged(color);
}
}
sauimone
updated documentation for barseries
r1493 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns the color of labels of this bar set.
sauimone
updated documentation for barseries
r1493 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 QColor QBarSet::labelColor()
{
return labelBrush().color();
}
sauimone
updated documentation for barseries
r1493 /*!
Miikka Heikkinen
Accelerating lineseries with OpenGL...
r2820 Sets the \a color of labels for this bar set.
sauimone
updated documentation for barseries
r1493 */
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 void QBarSet::setLabelColor(QColor color)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 {
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 QBrush b = labelBrush();
Marek Rosa
Chenged the order of conditions checking in chartstheme decorate functions
r1776 if (b == QBrush())
Marek Rosa
BarSet label brush is no longer reset to theme default brush if it was preset earlier
r1760 b.setStyle(Qt::SolidPattern);
Titta Heikkala
Fix QBarSet label color...
r2768 if (d_ptr->m_labelBrush.color() != color) {
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 b.setColor(color);
setLabelBrush(b);
emit labelColorChanged(color);
}
}
Michal Klocek
Adds big fat pimpl to series classes...
r938 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 QBarSetPrivate::QBarSetPrivate(const QString label, QBarSet *parent) : QObject(parent),
Michal Klocek
Adds big fat pimpl to series classes...
r938 q_ptr(parent),
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 m_label(label),
m_pen(QChartPrivate::defaultPen()),
m_brush(QChartPrivate::defaultBrush()),
m_labelBrush(QChartPrivate::defaultBrush())
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
}
QBarSetPrivate::~QBarSetPrivate()
{
}
sauimone
barset: selected is now private signal
r1017
sauimone
barchart signals for properties and changes
r1353 void QBarSetPrivate::append(QPointF value)
{
Mika Salmela
Fix to discard NaN, Inf and -Inf values from chart....
r2424 if (isValidValue(value)) {
m_values.append(value);
emit restructuredBars();
}
sauimone
barchart signals for properties and changes
r1353 }
void QBarSetPrivate::append(QList<QPointF> values)
{
Mika Salmela
Fix to discard NaN, Inf and -Inf values from chart....
r2424 for (int i = 0; i < values.count(); i++) {
if (isValidValue(values.at(i)))
m_values.append(values.at(i));
}
sauimone
barchart signals for properties and changes
r1353 emit restructuredBars();
}
void QBarSetPrivate::append(QList<qreal> values)
{
int index = m_values.count();
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < values.count(); i++) {
Mika Salmela
Fix to discard NaN, Inf and -Inf values from chart....
r2424 if (isValidValue(values.at(i))) {
m_values.append(QPointF(index, values.at(i)));
index++;
}
sauimone
barchart signals for properties and changes
r1353 }
emit restructuredBars();
}
void QBarSetPrivate::insert(const int index, const qreal value)
{
m_values.insert(index, QPointF(index, value));
emit restructuredBars();
}
void QBarSetPrivate::insert(const int index, const QPointF value)
{
m_values.insert(index, value);
emit restructuredBars();
}
sauimone
barset: removed boolean return value from remove(index,count) function
r1514 int QBarSetPrivate::remove(const int index, const int count)
sauimone
barchart signals for properties and changes
r1353 {
sauimone
barset: removed boolean return value from remove(index,count) function
r1514 int removeCount = count;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if ((index < 0) || (m_values.count() == 0))
return 0; // Invalid index or not values in list, remove nothing.
else if ((index + count) > m_values.count())
removeCount = m_values.count() - index; // Trying to remove more items than list has. Limit amount to be removed.
sauimone
barset: removed boolean return value from remove(index,count) function
r1514
int c = 0;
while (c < removeCount) {
sauimone
barchart signals for properties and changes
r1353 m_values.removeAt(index);
sauimone
barset: removed boolean return value from remove(index,count) function
r1514 c++;
sauimone
barchart signals for properties and changes
r1353 }
emit restructuredBars();
sauimone
barset: removed boolean return value from remove(index,count) function
r1514 return removeCount;
sauimone
barchart signals for properties and changes
r1353 }
void QBarSetPrivate::replace(const int index, const qreal value)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_values.replace(index, QPointF(index, value));
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 emit updatedLayout();
sauimone
barchart signals for properties and changes
r1353 }
void QBarSetPrivate::replace(const int index, const QPointF value)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_values.replace(index, value);
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 emit updatedLayout();
sauimone
barchart signals for properties and changes
r1353 }
sauimone
horizontal barchart & example
r1681 qreal QBarSetPrivate::pos(const int index)
sauimone
fixed crash in barchartitem after refactoring
r1603 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (index < 0 || index >= m_values.count())
sauimone
horizontal barchart & example
r1681 return 0;
return m_values.at(index).x();
sauimone
fixed crash in barchartitem after refactoring
r1603 }
sauimone
horizontal barchart & example
r1681 qreal QBarSetPrivate::value(const int index)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (index < 0 || index >= m_values.count())
sauimone
horizontal barchart & example
r1681 return 0;
return m_values.at(index).y();
}
sauimone
fixed crash in barchartitem after refactoring
r1603
sauimone
signals and slots for bars and sets
r239 #include "moc_qbarset.cpp"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "moc_qbarset_p.cpp"
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE