qbarseries.h
69 lines
| 1.9 KiB
| text/x-c
|
CLexer
sauimone
|
r338 | #ifndef BARSERIES_H | ||
#define BARSERIES_H | ||||
sauimone
|
r56 | |||
Michal Klocek
|
r360 | #include "qseries.h" | ||
sauimone
|
r377 | #include <QStringList> | ||
sauimone
|
r74 | |||
sauimone
|
r56 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
sauimone
|
r172 | class QBarSet; | ||
class BarChartModel; | ||||
sauimone
|
r412 | class BarCategory; | ||
sauimone
|
r172 | |||
sauimone
|
r56 | // Container for series | ||
Michal Klocek
|
r360 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QSeries | ||
sauimone
|
r56 | { | ||
sauimone
|
r71 | Q_OBJECT | ||
sauimone
|
r56 | public: | ||
sauimone
|
r377 | QBarSeries(QStringList categories, QObject* parent=0); | ||
sauimone
|
r56 | |||
Michal Klocek
|
r360 | virtual QSeriesType type() const { return QSeries::SeriesTypeBar; } | ||
sauimone
|
r56 | |||
sauimone
|
r280 | void addBarSet(QBarSet *set); // Takes ownership of set | ||
void removeBarSet(QBarSet *set); // Releases ownership, doesn't delete set | ||||
sauimone
|
r366 | int barsetCount(); | ||
int categoryCount(); | ||||
sauimone
|
r357 | QList<QBarSet*> barSets(); | ||
sauimone
|
r380 | QList<QSeries::Legend> legend(); | ||
sauimone
|
r280 | |||
sauimone
|
r288 | public: | ||
sauimone
|
r173 | // TODO: Functions below this are not part of api and will be moved | ||
sauimone
|
r296 | // to private implementation, when we start using it | ||
// TODO: TO PIMPL ---> | ||||
sauimone
|
r412 | QBarSet* barsetAt(int index); | ||
QString categoryName(int category); | ||||
sauimone
|
r172 | qreal min(); | ||
qreal max(); | ||||
qreal valueAt(int set, int category); | ||||
sauimone
|
r288 | qreal percentageAt(int set, int category); | ||
qreal categorySum(int category); | ||||
sauimone
|
r172 | qreal maxCategorySum(); | ||
BarChartModel& model(); | ||||
sauimone
|
r296 | // <--- TO PIMPL | ||
sauimone
|
r172 | |||
signals: | ||||
sauimone
|
r425 | //void changed(int index); | ||
void clicked(QBarSet* barset, QString category); // Up to user of api, what to do with these signals | ||||
void rightClicked(QBarSet* barset, QString category); | ||||
sauimone
|
r172 | |||
sauimone
|
r288 | // TODO: internal signals, these to private implementation. | ||
sauimone
|
r296 | // TODO: TO PIMPL ---> | ||
sauimone
|
r288 | void showToolTip(QPoint pos, QString tip); | ||
sauimone
|
r296 | // <--- TO PIMPL | ||
public Q_SLOTS: | ||||
sauimone
|
r357 | void setToolTipEnabled(bool enabled=true); // enables tooltips | ||
void setSeparatorsEnabled(bool enabled=true); // enables separators between categories | ||||
sauimone
|
r171 | |||
sauimone
|
r425 | // TODO: TO PIMPL ---> | ||
void barsetClicked(QString category); | ||||
void barsetRightClicked(QString category); | ||||
// <--- TO PIMPL | ||||
sauimone
|
r281 | protected: | ||
sauimone
|
r172 | BarChartModel* mModel; | ||
sauimone
|
r56 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
sauimone
|
r338 | #endif // BARSERIES_H | ||