bar_p.h
56 lines
| 1.2 KiB
| text/x-c
|
CLexer
sauimone
|
r56 | #ifndef BAR_H | ||
#define BAR_H | ||||
#include "qchartglobal.h" | ||||
sauimone
|
r256 | #include <QGraphicsObject> | ||
sauimone
|
r183 | #include <QPen> | ||
#include <QBrush> | ||||
sauimone
|
r56 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
sauimone
|
r280 | // Single visual bar item of chart | ||
sauimone
|
r256 | class Bar : public QGraphicsObject | ||
sauimone
|
r56 | { | ||
sauimone
|
r256 | Q_OBJECT | ||
sauimone
|
r56 | public: | ||
sauimone
|
r425 | Bar(QString category, QGraphicsItem *parent=0); | ||
sauimone
|
r74 | |||
sauimone
|
r247 | public: // from ChartItem | ||
void setSize(const QSizeF &size); | ||||
sauimone
|
r56 | |||
// Layout Stuff | ||||
sauimone
|
r280 | void resize(qreal w, qreal h); | ||
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
|
r256 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
sauimone
|
r276 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||||
sauimone
|
r256 | |||
Q_SIGNALS: | ||||
sauimone
|
r425 | void clicked(QString category); | ||
void rightClicked(QString category); | ||||
sauimone
|
r283 | void hoverEntered(QPoint pos); | ||
void hoverLeaved(); | ||||
sauimone
|
r56 | |||
private: | ||||
qreal mXpos; | ||||
qreal mYpos; | ||||
sauimone
|
r565 | qreal mWidth; | ||
qreal mHeight; | ||||
sauimone
|
r74 | |||
sauimone
|
r183 | QBrush mBrush; | ||
QPen mPen; | ||||
sauimone
|
r425 | QString mCategory; | ||
sauimone
|
r56 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // BAR_H | ||||