axisitem_p.h
75 lines
| 1.7 KiB
| text/x-c
|
CLexer
/ src / axisitem_p.h
Michal Klocek
|
r67 | #ifndef AXISITEM_H_ | ||
#define AXISITEM_H_ | ||||
Michal Klocek
|
r140 | #include "domain_p.h" | ||
Tero Ahola
|
r104 | #include "chartitem_p.h" | ||
Michal Klocek
|
r67 | #include <QGraphicsItem> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Michal Klocek
|
r140 | class QChartAxis; | ||
class AxisItem : public QObject, public ChartItem | ||||
Michal Klocek
|
r67 | { | ||
Michal Klocek
|
r140 | Q_OBJECT | ||
Michal Klocek
|
r67 | public: | ||
enum AxisType{X_AXIS,Y_AXIS}; | ||||
Michal Klocek
|
r176 | AxisItem(AxisType type = X_AXIS,QGraphicsItem* parent = 0); | ||
Michal Klocek
|
r67 | ~AxisItem(); | ||
//from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
Michal Klocek
|
r176 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||
Michal Klocek
|
r67 | |||
Michal Klocek
|
r176 | AxisType axisType() const {return m_type;}; | ||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r176 | void setGridOpacity(qreal opacity); | ||
qreal gridOpacity() const; | ||||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r176 | void setLabelsOpacity(qreal opacity); | ||
qreal labelsOpacity() const; | ||||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r176 | void setShadesOpacity(qreal opacity); | ||
qreal shadesOpacity() const; | ||||
Michal Klocek
|
r67 | |||
Michal Klocek
|
r176 | void setLabelsAngle(int angle); | ||
int labelsAngle()const { return m_labelsAngle; } | ||||
void setTicks(int count); | ||||
int ticks() const { return m_ticks;} | ||||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r176 | void setShadesBrush(const QBrush& brush); | ||
void setShadesPen(const QPen& pen); | ||||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r176 | void setGridPen(const QPen& pen); | ||
void setLabelsPen(const QPen& pen); | ||||
void setLabelsBrush(const QBrush& brush); | ||||
void setLabelsFont(const QFont& font); | ||||
public slots: | ||||
void handleAxisChanged(const QChartAxis& axis); | ||||
void handleDomainChanged(const Domain& domain); | ||||
void handleGeometryChanged(const QRectF& size); | ||||
protected: | ||||
void updateDomain(); | ||||
Michal Klocek
|
r85 | private: | ||
Michal Klocek
|
r176 | void clear(); | ||
Michal Klocek
|
r85 | void createItems(); | ||
Michal Klocek
|
r67 | private: | ||
Michal Klocek
|
r140 | AxisType m_type; | ||
Michal Klocek
|
r67 | int m_ticks; | ||
Michal Klocek
|
r140 | Domain m_domain; | ||
QRectF m_rect; | ||||
Michal Klocek
|
r176 | int m_labelsAngle; | ||
bool m_shadesEnabled; | ||||
QGraphicsItemGroup m_grid; | ||||
QGraphicsItemGroup m_shades; | ||||
QGraphicsItemGroup m_labels; | ||||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r67 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif /* AXISITEM_H_ */ | ||||