##// END OF EJS Templates
Bugfix: axis visibily issues...
Bugfix: axis visibily issues * adds missing isTitleVisible * fixes axis->setVisible * invalidate layout when visibilty changed

File last commit:

r2104:f8a933676fbd
r2297:bf59b22cf3e9
Show More
qbarset.cpp
638 lines | 15.3 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
sauimone
proof of concept implementation for barset and barcategory
r169 #include "qbarset.h"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "qbarset_p.h"
sauimone
proof of concept implementation for barset and barcategory
r169
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
Documentation for bar charts
r313 /*!
\class QBarSet
sauimone
better brief descriptions for barcharts
r1502 \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.
sauimone
updated documentation and examples for barcharts
r325 \mainclass
sauimone
GroupedBarSeries to BarSeries
r1594 \sa QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries
sauimone
Documentation for bar charts
r313 */
Tero Ahola
Documenting QML bar series API
r1489 /*!
\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.
sauimone
GroupedBarSeries to BarSeries
r1594 \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
Tero Ahola
Documenting QML bar series API
r1489 Defines the label of the barSet.
*/
/*!
\qmlproperty string BarSet::label
Defines the label of the barSet.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
\property QBarSet::pen
\brief Defines the pen used by the barSet.
*/
/*!
\property QBarSet::brush
\brief Defines the brush used by the barSet.
*/
/*!
\property QBarSet::labelBrush
\brief Defines the brush used by the barSet's label.
*/
/*!
\property QBarSet::labelFont
\brief Defines the font used by the barSet's label.
*/
Jani Honkonen
Add qml Font properties & docs
r1517 /*!
\qmlproperty Font BarSet::labelFont
Defines the font used by the barSet's label.
See the \l {Font} {QML Font Element} for detailed documentation.
*/
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)
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 QBarSet::hovered(bool status)
The signal is emitted if mouse is hovered on top of barset.
Parameter \a status is true, if mouse entered on top of barset, false if mouse left from top of barset.
*/
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()
This signal is emitted when the label of the barSet has changed.
\sa label
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Tero Ahola
QML signals documentation
r1531 /*!
\qmlsignal BarSet::onLabelChanged()
This signal is emitted when the label of the barSet has changed.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
\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
*/
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.
Parameter \a count is the number of iserted values.
\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.
Parameter \a count is the number of iserted values.
*/
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
The count of values on the barset
*/
/*!
\qmlproperty QVariantList BarSet::values
The values of the barset. You can set either a list of reals or a list of points as values. If you set a list of
reals as values, the values are automatically completed to points by using the index of a value as it's
x-coordinate. For example:
\code
myBarSet1.values = [0, 5, 1, 5];
myBarSet2.values = [Qt.point(0, 1), Qt.point(1, 5), Qt.point(2.2, 4.3)];
\endcode
*/
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 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 /*!
Destroys the barset
*/
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
sauimone
Removed QPointF from QBarSet
r1580 are appended to end of barset
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.
The value that is currently at this postion is moved to postion index + 1
\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 /*!
sauimone
barset: unified insert/set/remove methods
r993 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 /*!
sauimone
Removed QPointF from QBarSet
r1580 Returns sum of all values in barset.
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 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_pen;
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
Documentation for bar charts
r313 /*!
Sets brush for the set. Bars of this set are drawn using \a brush
*/
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 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 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 /*!
sauimone
fixed clipping in barcharts
r839 Sets \a brush of the values that are drawn on top of this barset
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 }
/*!
Returns brush of the values that are drawn on top of this barset
*/
QBrush QBarSet::labelBrush() const
{
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_labelBrush;
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 }
/*!
sauimone
fixed clipping in barcharts
r839 Sets the \a font for values that are drawn on top of this barset
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 }
/*!
sauimone
updated documentation for barseries
r1493 Returns the pen for values that are drawn on top of this barset
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 /*!
Returns the color of the brush of barset.
*/
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 /*!
Sets the \a color of brush for this barset
*/
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 /*!
Returns the color of pen of this barset
*/
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 /*!
Sets the color of pen for this barset
*/
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 /*!
Returns the color of labels of this barset
*/
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 /*!
Sets the color of labels for this barset
*/
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);
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 if (b.color() != color) {
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),
sauimone
changed barset name to label to be consistent with pie series. Series have names, barsets and pieslices have labels
r1429 m_label(label)
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)
{
m_values.append(value);
emit restructuredBars();
}
void QBarSetPrivate::append(QList<QPointF> values)
{
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < values.count(); i++)
sauimone
barchart signals for properties and changes
r1353 m_values.append(values.at(i));
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++) {
m_values.append(QPointF(index, values.at(i)));
sauimone
barchart signals for properties and changes
r1353 index++;
}
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
sauimone
proof of concept implementation for barset and barcategory
r169 QTCOMMERCIALCHART_END_NAMESPACE