legendmarker_p.h
62 lines
| 1.5 KiB
| text/x-c
|
CLexer
/ src / legendmarker_p.h
sauimone
|
r547 | #ifndef LEGENDMARKER_P_H | ||
#define LEGENDMARKER_P_H | ||||
#include "qchartglobal.h" | ||||
#include <QGraphicsObject> | ||||
#include <QBrush> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class QSeries; | ||||
sauimone
|
r565 | class QBarSet; | ||
class QPieSlice; | ||||
sauimone
|
r547 | |||
sauimone
|
r565 | // TODO: split this to 3 different markers for series, barset and pieslice. Current implementation is easier to misuse... | ||
sauimone
|
r547 | class LegendMarker : public QGraphicsObject | ||
{ | ||||
Q_OBJECT | ||||
sauimone
|
r565 | |||
enum LegendMarkerType { | ||||
LegendMarkerTypeSeries, | ||||
LegendMarkerTypeBarset, | ||||
LegendMarkerTypePieslice | ||||
}; | ||||
sauimone
|
r547 | public: | ||
LegendMarker(QSeries* series, QGraphicsItem *parent = 0); | ||||
sauimone
|
r565 | LegendMarker(QBarSet* barset, QGraphicsItem *parent = 0); | ||
LegendMarker(QPieSlice* pieslice, QGraphicsItem *parent = 0); | ||||
sauimone
|
r547 | void setBoundingRect(const QRectF rect); | ||
sauimone
|
r565 | |||
sauimone
|
r547 | void setBrush(const QBrush brush); | ||
sauimone
|
r565 | QBrush brush() const; | ||
sauimone
|
r547 | void setName(const QString name); | ||
QString name() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||||
QRectF boundingRect() const; | ||||
public: | ||||
// From QGraphicsObject | ||||
void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||||
Q_SIGNALS: | ||||
sauimone
|
r567 | void clicked(QSeries* series, Qt::MouseButton button); | ||
void clicked(QBarSet* barset, Qt::MouseButton button); | ||||
void clicked(QPieSlice* pieslice, Qt::MouseButton button); | ||||
sauimone
|
r547 | |||
private: | ||||
QRectF mBoundingRect; | ||||
QBrush mBrush; | ||||
QString mName; | ||||
QSeries* mSeries; | ||||
sauimone
|
r565 | QBarSet* mBarset; | ||
QPieSlice* mPieslice; | ||||
LegendMarkerType mType; | ||||
sauimone
|
r547 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // LEGENDMARKER_P_H | ||||