##// END OF EJS Templates
More examples on QChartView qdoc
More examples on QChartView qdoc

File last commit:

r319:c54c34ca0b57
r321:13ac9d78995f
Show More
qbarset.cpp
165 lines | 3.1 KiB | text/x-c | CppLexer
sauimone
proof of concept implementation for barset and barcategory
r169 #include "qbarset.h"
sauimone
signals and slots for bars and sets
r239 #include <QDebug>
sauimone
tooltip for barcharts
r283 #include <QToolTip>
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.
\sa QBarCategory, QBarChartSeries, QStackedBarChartSeries, QPercentBarChartSeries
*/
/*!
\fn void QBarSet::clicked()
\brief signals that set has been clicked
*/
/*!
\fn void QBarSet::hoverEnter(QPoint pos)
\brief signals that mouse has entered over the set at position \a pos.
*/
/*!
\fn void QBarSet::hoverLeave()
\brief signals that mouse has left from the set.
*/
/*!
\fn void QBarSet::toggleFloatingValues()
sauimone
Updated barchart documentation
r319 \brief \internal
sauimone
Documentation for bar charts
r313 */
/*!
\fn void QBarSet::showToolTip(QPoint pos, QString tip)
sauimone
Updated barchart documentation
r319 \brief \internal \a pos \a tip
sauimone
Documentation for bar charts
r313 */
/*!
Constructs QBarSet with a name of \a name and with parent of \a parent
*/
sauimone
barcharts: added legend to model. added signals for hover events (for tooltip). updated examples
r280 QBarSet::QBarSet(QString name, QObject *parent)
sauimone
updated barchart examples. minor fixes
r276 : QObject(parent)
sauimone
barcharts: added legend to model. added signals for hover events (for tooltip). updated examples
r280 ,mName(name)
sauimone
proof of concept implementation for barset and barcategory
r169 {
}
sauimone
Documentation for bar charts
r313 /*!
Sets new \a name for set.
*/
sauimone
proof of concept implementation for barset and barcategory
r169 void QBarSet::setName(QString name)
{
mName = name;
}
sauimone
Documentation for bar charts
r313
/*!
Returns name of the set.
*/
sauimone
Barset and barcategory implememtation. Updated test application
r171 QString QBarSet::name()
{
return mName;
}
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
proof of concept implementation for barset and barcategory
r169 QBarSet& QBarSet::operator << (const qreal &value)
{
mValues.append(value);
return *this;
}
sauimone
Documentation for bar charts
r313 /*!
Returns count of values in set.
*/
sauimone
Barset and barcategory implememtation. Updated test application
r171 int QBarSet::count()
{
return mValues.count();
}
sauimone
Documentation for bar charts
r313 /*!
Returns value of set indexed by \a index
*/
sauimone
Barset and barcategory implememtation. Updated test application
r171 qreal QBarSet::valueAt(int index)
{
return mValues.at(index);
}
sauimone
Documentation for bar charts
r313 /*!
Sets a new value \a value to set, indexed by \a index
*/
sauimone
brush support for bargroups
r183 void QBarSet::setValue(int index, qreal value)
{
mValues.replace(index,value);
}
sauimone
Documentation for bar charts
r313 /*!
Sets pen for set. Bars of this set are drawn using \a pen
*/
sauimone
Added pen & brush to QBarSet
r214 void QBarSet::setPen(const QPen& pen)
{
mPen = pen;
}
sauimone
Documentation for bar charts
r313 /*!
Returns pen of the set.
*/
sauimone
Added pen & brush to QBarSet
r214 const QPen& QBarSet::pen() const
{
return mPen;
}
sauimone
Documentation for bar charts
r313 /*!
Sets brush for the set. Bars of this set are drawn using \a brush
*/
sauimone
Added pen & brush to QBarSet
r214 void QBarSet::setBrush(const QBrush& brush)
{
mBrush = brush;
}
sauimone
Documentation for bar charts
r313 /*!
Returns brush of the set.
*/
sauimone
Added pen & brush to QBarSet
r214 const QBrush& QBarSet::brush() const
{
return mBrush;
}
sauimone
Documentation for bar charts
r313 /*!
sauimone
Updated barchart documentation
r319 \internal
sauimone
Documentation for bar charts
r313 */
sauimone
signals and slots for bars and sets
r239 void QBarSet::barClicked()
{
sauimone
moved tooltip to presenter
r288 // qDebug() << "QBarset::barClicked" << this;
sauimone
signals and slots for bars and sets
r239 // Some bar of this set has been clicked
// TODO: What happens then?
sauimone
Floating values to bar charts
r263 emit clicked(); // Notify that set has been clicked
sauimone
signals and slots for bars and sets
r239 }
sauimone
Added pen & brush to QBarSet
r214
sauimone
Documentation for bar charts
r313 /*!
sauimone
Updated barchart documentation
r319 \internal \a pos
sauimone
Documentation for bar charts
r313 */
sauimone
tooltip for barcharts
r283 void QBarSet::barHoverEntered(QPoint pos)
sauimone
updated barchart examples. minor fixes
r276 {
sauimone
enablers for tooltip and floating values, bug fixing, updated examples. tidying up the code
r296 emit showToolTip(pos, mName);
sauimone
moved tooltip to presenter
r288 emit hoverEnter(pos);
sauimone
updated barchart examples. minor fixes
r276 }
sauimone
Documentation for bar charts
r313 /*!
sauimone
Updated barchart documentation
r319 \internal
sauimone
Documentation for bar charts
r313 */
sauimone
updated barchart examples. minor fixes
r276 void QBarSet::barHoverLeaved()
{
sauimone
moved tooltip to presenter
r288 // qDebug() << "QBarset::barHoverLeaved" << this;
// if (mToolTipEnabled) {
// TODO: do what?
// }
// Emit signal to user of charts
emit hoverLeave();
sauimone
updated barchart examples. minor fixes
r276 }
sauimone
signals and slots for bars and sets
r239 #include "moc_qbarset.cpp"
sauimone
proof of concept implementation for barset and barcategory
r169 QTCOMMERCIALCHART_END_NAMESPACE