##// END OF EJS Templates
Enabled dummy bar chart impl in QML again
Enabled dummy bar chart impl in QML again

File last commit:

r993:f8e943006326
r1004:5a2832f9c305
Show More
qbarset.cpp
308 lines | 6.6 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
\brief part of QtCommercial chart API.
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
replaced qbarcategory with qstringlist
r377 \sa QBarSeries, QStackedBarSeries, QPercentBarSeries
sauimone
Documentation for bar charts
r313 */
/*!
sauimone
combined clicked and rightclicked signals in barchart
r812 \fn void QBarSet::clicked(QString category, Qt::MouseButtons button)
sauimone
Documentation for bar charts
r313 \brief signals that set has been clicked
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425 Parameter \a category describes on which category was clicked
sauimone
combined clicked and rightclicked signals in barchart
r812 Parameter \a button mouse button
sauimone
Better way to enable features to user. Do less, but expose signals to user and allow user to descide what to do.
r425 */
sauimone
barchart: doc update for hover signals
r980 /*!
\fn void QBarSet::selected()
\brief signals that set has been selected
*/
sauimone
barchart: removed tooltip. hoverEntered and hoverLeaved signals combined to hovered(bool) signal
r975 /*!
\fn void QBarSet::hovered(bool status)
\brief signals that mouse has hovered over the set. If \a status is true, then mouse was entered. If \a status is false, then mouse was left.
sauimone
barchart: doc update for hover signals
r980
The signal is emitted if mouse is hovered on top of set
Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
sauimone
barchart: removed tooltip. hoverEntered and hoverLeaved signals combined to hovered(bool) signal
r975 */
sauimone
Documentation for bar charts
r313 /*!
Constructs QBarSet with a name of \a name and with parent of \a parent
*/
sauimone
barset: unified insert/set/remove methods
r993 QBarSet::QBarSet(const QString name, QObject *parent)
sauimone
updated barchart examples. minor fixes
r276 : QObject(parent)
sauimone
barchart pimpl part 1
r934 ,d_ptr(new QBarSetPrivate(name,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 /*!
Sets new \a name for set.
*/
sauimone
barset: unified insert/set/remove methods
r993 void QBarSet::setName(const QString name)
sauimone
proof of concept implementation for barset and barcategory
r169 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 d_ptr->m_name = name;
sauimone
proof of concept implementation for barset and barcategory
r169 }
sauimone
Documentation for bar charts
r313
/*!
Returns name of the set.
*/
sauimone
const to getters, renamed addBarset to appendBarset
r776 QString QBarSet::name() const
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_name;
sauimone
Barset and barcategory implememtation. Updated test application
r171 }
sauimone
proof of concept implementation for barset and barcategory
r169
sauimone
Documentation for bar charts
r313 /*!
Appends new value \a value to the end of set.
*/
sauimone
barset: unified insert/set/remove methods
r993 void QBarSet::append(const qreal value)
sauimone
proof of concept implementation for barset and barcategory
r169 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 d_ptr->m_values.append(value);
emit d_ptr->structureChanged();
sauimone
barset: unified insert/set/remove methods
r993 }
/*!
Appends new value \a value to the end of set.
*/
QBarSet& QBarSet::operator << (const qreal &value)
{
append(value);
sauimone
proof of concept implementation for barset and barcategory
r169 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
barset: unified insert/set/remove methods
r993 d_ptr->m_values.insert(index, value);
Marek Rosa
Adding data to BarSet through model added
r662 }
Marek Rosa
Updated spline chart example documentation and added some more docs to barseries
r901 /*!
sauimone
barset: unified insert/set/remove methods
r993 Removes the value specified by \a index
\sa insert()
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::remove(const int index)
Marek Rosa
Removing data from BarSeries through model added
r663 {
sauimone
barset: unified insert/set/remove methods
r993 d_ptr->m_values.removeAt(index);
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 {
sauimone
barset: unified insert/set/remove methods
r993 d_ptr->m_values.replace(index,value);
emit d_ptr->valueChanged();
sauimone
Barset and barcategory implememtation. Updated test application
r171 }
sauimone
Documentation for bar charts
r313 /*!
Returns value of set indexed by \a index
*/
sauimone
barset: unified insert/set/remove methods
r993 qreal QBarSet::at(const int index) const
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_values.at(index);
sauimone
Barset and barcategory implememtation. Updated test application
r171 }
sauimone
Documentation for bar charts
r313 /*!
sauimone
barset: unified insert/set/remove methods
r993 Returns value of set indexed by \a index
sauimone
Documentation for bar charts
r313 */
sauimone
barset: unified insert/set/remove methods
r993 qreal QBarSet::operator [] (int index) const
sauimone
brush support for bargroups
r183 {
sauimone
barset: unified insert/set/remove methods
r993 return d_ptr->m_values.at(index);
}
/*!
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
barchart pimpl part 1
r934 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);
Michal Klocek
Adds big fat pimpl to series classes...
r938 for (int i=0; i < d_ptr->m_values.count(); i++) {
total += d_ptr->m_values.at(i);
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 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 if(d_ptr->m_pen!=pen){
d_ptr->m_pen = pen;
emit d_ptr->valueChanged();
}
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 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 if(d_ptr->m_brush!=brush){
d_ptr->m_brush = brush;
emit d_ptr->valueChanged();
}
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
better use of gradients in barcharts
r512 /*!
sauimone
fixed clipping in barcharts
r839 Sets \a pen of the 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 void QBarSet::setLabelPen(const QPen &pen)
sauimone
better use of gradients in barcharts
r512 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 if(d_ptr->m_labelPen!=pen){
d_ptr->m_labelPen = pen;
emit d_ptr->valueChanged();
}
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 }
/*!
Returns pen of the values that are drawn on top of this barset
*/
QPen QBarSet::labelPen() const
{
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_labelPen;
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)
{
Michal Klocek
Adds big fat pimpl to series classes...
r938 if(d_ptr->m_labelBrush!=brush){
d_ptr->m_labelBrush = brush;
emit d_ptr->valueChanged();
}
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)
{
Michal Klocek
Adds big fat pimpl to series classes...
r938 if(d_ptr->m_labelFont!=font) {
d_ptr->m_labelFont = font;
emit d_ptr->valueChanged();
}
sauimone
better use of gradients in barcharts
r512 }
/*!
sauimone
Barchart value layout fix
r817 Returns the pen for values that are drawn on top of this 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
values visibility handling changed in barchart
r813 /*!
Marek Rosa
Docs updated
r908 Sets visibility of bar labels. If \a visible is true, labels are drawn on top of barsets.
sauimone
values visibility handling changed in barchart
r813 */
Marek Rosa
Docs updated
r908
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void QBarSet::setLabelsVisible(bool visible)
{
Michal Klocek
Adds big fat pimpl to series classes...
r938 if(d_ptr->m_labelsVisible!=visible) {
d_ptr->m_labelsVisible = visible;
emit d_ptr->labelsVisibleChanged(visible);
}
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 }
/*!
Returns the visibility of values
*/
bool QBarSet::labelsVisible() const
sauimone
values visibility handling changed in barchart
r813 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 return d_ptr->m_labelsVisible;
sauimone
values visibility handling changed in barchart
r813 }
Michal Klocek
Adds big fat pimpl to series classes...
r938 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
barset: unified insert/set/remove methods
r993 QBarSetPrivate::QBarSetPrivate(const QString name, QBarSet *parent) : QObject(parent),
Michal Klocek
Adds big fat pimpl to series classes...
r938 q_ptr(parent),
m_name(name),
m_labelsVisible(false)
{
}
QBarSetPrivate::~QBarSetPrivate()
{
}
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