barchartmodel_p.h
52 lines
| 1.2 KiB
| text/x-c
|
CLexer
|
r159 | #ifndef BARCHARTMODEL_H | ||
#define BARCHARTMODEL_H | ||||
#include <QObject> | ||||
|
r161 | #include "qchartglobal.h" | ||
|
r159 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r161 | // Model for bar chart. Internal class. | ||
|
r159 | // TODO: Implement as QAbstractItemModel? | ||
|
r169 | class QBarSet; | ||
class QBarCategory; | ||||
|
r159 | class BarChartModel : public QObject //, public QAbstractItemModel | ||
{ | ||||
Q_OBJECT | ||||
public: | ||||
|
r169 | explicit BarChartModel(QBarCategory &category, QObject *parent = 0); | ||
|
r159 | |||
|
r171 | QBarCategory& category(); | ||
|
r169 | void addBarSet(QBarSet &set); | ||
void removeBarSet(QBarSet &set); | ||||
|
r171 | int countSets(); // Number of sets in model | ||
int countCategories(); // Number of categories | ||||
int countTotalItems(); // Total items in all sets. Includes empty items. | ||||
|
r159 | |||
|
r171 | qreal max(); // Maximum value of all sets | ||
qreal min(); // Minimum value of all sets | ||||
qreal valueAt(int set, int category); | ||||
|
r159 | |||
|
r171 | qreal categorySum(int column); | ||
qreal maxCategorySum(); // returns maximum sum of sets in all categories. | ||||
|
r161 | |||
|
r172 | QString label(int category); | ||
|
r159 | signals: | ||
void modelUpdated(); | ||||
public slots: | ||||
private: | ||||
|
r171 | QList<QBarSet*> mDataModel; | ||
|
r169 | QBarCategory& mCategory; | ||
|
r159 | |||
}; | ||||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // BARCHARTMODEL_H | ||||