axisitem_p.h
63 lines
| 1.1 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
|
r140 | AxisItem(QChartAxis* axis,AxisType type = X_AXIS,QGraphicsItem* parent = 0); | ||
Michal Klocek
|
r67 | ~AxisItem(); | ||
//from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
Michal Klocek
|
r85 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){}; | ||
Michal Klocek
|
r67 | |||
Michal Klocek
|
r140 | protected slots: | ||
void handleAxisChanged(); | ||||
void handleDomainChanged(const Domain& domain); | ||||
void handleGeometryChanged(const QRectF& size); | ||||
protected: | ||||
void updateDomain(); | ||||
private: | ||||
void clear(); | ||||
Tero Ahola
|
r103 | public: | ||
Michal Klocek
|
r67 | AxisType axisType() const {return m_type;}; | ||
Michal Klocek
|
r140 | protected: | ||
Michal Klocek
|
r85 | private: | ||
void createItems(); | ||||
Michal Klocek
|
r67 | private: | ||
Michal Klocek
|
r140 | |||
QChartAxis* m_axis; | ||||
AxisType m_type; | ||||
Michal Klocek
|
r67 | int m_ticks; | ||
Michal Klocek
|
r140 | Domain m_domain; | ||
QRectF m_rect; | ||||
Michal Klocek
|
r67 | QPainterPath m_path; | ||
Michal Klocek
|
r85 | |||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r85 | QList<QGraphicsLineItem*> m_grid; | ||
QList<QGraphicsRectItem*> m_shades; | ||||
QList<QGraphicsSimpleTextItem*> m_labels; | ||||
Michal Klocek
|
r140 | |||
Michal Klocek
|
r67 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif /* AXISITEM_H_ */ | ||||