bar_p.h
56 lines
| 1.0 KiB
| text/x-c
|
CLexer
sauimone
|
r56 | #ifndef BAR_H | ||
#define BAR_H | ||||
sauimone
|
r239 | //#include "chartitem_p.h" | ||
sauimone
|
r56 | #include "qchartglobal.h" | ||
sauimone
|
r239 | #include <QGraphicsObject> | ||
sauimone
|
r183 | #include <QPen> | ||
#include <QBrush> | ||||
sauimone
|
r56 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
// Single bar item of chart | ||||
sauimone
|
r239 | class Bar : public QGraphicsObject | ||
sauimone
|
r56 | { | ||
sauimone
|
r239 | Q_OBJECT | ||
sauimone
|
r56 | public: | ||
Tero Ahola
|
r103 | Bar(QGraphicsItem *parent=0); | ||
sauimone
|
r74 | |||
sauimone
|
r239 | public: | ||
sauimone
|
r56 | |||
// Layout Stuff | ||||
sauimone
|
r183 | void resize(qreal w, qreal h); // Size of bar. | ||
sauimone
|
r56 | void setPos(qreal x, qreal y); | ||
sauimone
|
r183 | void setPen(QPen pen); | ||
void setBrush(QBrush brush); | ||||
sauimone
|
r56 | |||
public: | ||||
sauimone
|
r239 | // From QGraphicsItem | ||
sauimone
|
r56 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||
QRectF boundingRect() const; | ||||
sauimone
|
r239 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||||
void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||||
Q_SIGNALS: | ||||
void clicked(); | ||||
void hoverEnter(); | ||||
void hoverLeave(); | ||||
sauimone
|
r56 | |||
private: | ||||
sauimone
|
r113 | qreal mHeight; | ||
qreal mWidth; | ||||
sauimone
|
r56 | qreal mXpos; | ||
qreal mYpos; | ||||
sauimone
|
r74 | |||
sauimone
|
r183 | QBrush mBrush; | ||
QPen mPen; | ||||
sauimone
|
r56 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // BAR_H | ||||