bargroupbase.h
70 lines
| 1.8 KiB
| text/x-c
|
CLexer
sauimone
|
r126 | #ifndef BARGROUPBASE_H | ||
#define BARGROUPBASE_H | ||||
#include "chartitem_p.h" | ||||
sauimone
|
r159 | #include "barchartmodel_p.h" | ||
sauimone
|
r183 | #include <QPen> | ||
#include <QBrush> | ||||
sauimone
|
r126 | #include <QGraphicsItem> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
// Base Class for bar groups. Common implemantation of different groups. Not to be instantiated. | ||||
Michal Klocek
|
r139 | class BarGroupBase : public QObject, public ChartItem | ||
sauimone
|
r126 | { | ||
Michal Klocek
|
r139 | Q_OBJECT | ||
sauimone
|
r126 | public: | ||
sauimone
|
r172 | BarGroupBase(BarChartModel& model, QGraphicsItem *parent = 0); | ||
sauimone
|
r126 | void setSeparatorsVisible(bool visible = true); | ||
sauimone
|
r175 | public: | ||
sauimone
|
r126 | |||
// From QGraphicsItem | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QRectF boundingRect() const; | ||||
// TODO: these may change with layout awarness. | ||||
void setBarWidth( int w ); | ||||
sauimone
|
r183 | // int addColor( QColor color ); | ||
// void resetColors(); | ||||
void resetBrushes(); | ||||
void addBrush(QBrush brush); | ||||
void setPen(QPen pen); | ||||
QPen pen(); | ||||
void setBrush(QBrush brush); | ||||
QBrush brush(); | ||||
sauimone
|
r126 | |||
sauimone
|
r167 | // TODO: Consider the domain for layoutChanged. May be use case, may not be. If it is, then the derived classes need to implement it | ||
sauimone
|
r126 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes | ||
virtual void layoutChanged() = 0; // layout has changed -> need to recalculate bar sizes | ||||
Michal Klocek
|
r139 | protected slots: | ||
void handleModelChanged(int index); | ||||
void handleDomainChanged(const Domain& domain); | ||||
void handleGeometryChanged(const QRectF& size); | ||||
sauimone
|
r126 | protected: | ||
sauimone
|
r159 | // TODO: consider these. | ||
sauimone
|
r126 | int mHeight; // Layout spesific | ||
int mWidth; | ||||
int mBarDefaultWidth; | ||||
bool mLayoutSet; // True, if component has been laid out. | ||||
bool mLayoutDirty; | ||||
QList<QColor> mColors; // List of colors for series for now | ||||
bool mSeparatorsVisible; | ||||
sauimone
|
r161 | BarChartModel& mModel; | ||
sauimone
|
r159 | |||
sauimone
|
r183 | QPen mPen; | ||
QList<QBrush> mBrushes; | ||||
sauimone
|
r126 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // BARGROUPBASE_H | ||||