qlegend.h
86 lines
| 2.1 KiB
| text/x-c
|
CLexer
/ src / qlegend.h
sauimone
|
r524 | #ifndef QLEGEND_H | ||
#define QLEGEND_H | ||||
#include "qchartglobal.h" | ||||
#include "qseries.h" | ||||
#include <QGraphicsObject> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class Domain; | ||||
sauimone
|
r529 | class LegendMarker; | ||
sauimone
|
r565 | class QPieSlice; | ||
class QXYSeries; | ||||
class QBarSet; | ||||
class QBarSeries; | ||||
class QPieSeries; | ||||
sauimone
|
r524 | |||
sauimone
|
r529 | class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsObject | ||
sauimone
|
r524 | { | ||
Q_OBJECT | ||||
public: | ||||
sauimone
|
r616 | enum PreferredLayout { | ||
PreferredLayoutHorizontal, | ||||
PreferredLayoutVertical | ||||
}; | ||||
sauimone
|
r524 | explicit QLegend(QGraphicsItem *parent = 0); | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||||
QRectF boundingRect() const; | ||||
Michal Klocek
|
r645 | void setBrush(const QBrush& brush); | ||
QBrush brush() const; | ||||
void setPen(const QPen& pen); | ||||
QPen pen() const; | ||||
sauimone
|
r540 | |||
sauimone
|
r616 | void setPreferredLayout(QLegend::PreferredLayout preferred); | ||
QSizeF maximumSize() const; | ||||
void setMaximumSize(const QSizeF size); | ||||
sauimone
|
r582 | |||
sauimone
|
r626 | void setSize(const QSizeF size); | ||
void setPos(const QPointF &pos); | ||||
sauimone
|
r524 | signals: | ||
sauimone
|
r547 | // for interactions. | ||
sauimone
|
r567 | void clicked(QSeries* series, Qt::MouseButton button); | ||
void clicked(QBarSet* barset, Qt::MouseButton button); | ||||
void clicked(QPieSlice* slice, Qt::MouseButton button); | ||||
sauimone
|
r547 | |||
sauimone
|
r524 | public slots: | ||
void handleSeriesAdded(QSeries* series,Domain* domain); | ||||
void handleSeriesRemoved(QSeries* series); | ||||
sauimone
|
r637 | void handleAdded(QList<QPieSlice*> slices); | ||
sauimone
|
r643 | void handleRemoved(QList<QPieSlice*> slices); | ||
sauimone
|
r637 | void handleMarkerDestroyed(); | ||
sauimone
|
r524 | |||
private: | ||||
sauimone
|
r565 | // PIMPL ---> | ||
sauimone
|
r637 | void connectSeries(QSeries* series); | ||
void disconnectSeries(QSeries* series); | ||||
sauimone
|
r586 | void createMarkers(QSeries* series); | ||
sauimone
|
r626 | void appendMarkers(QXYSeries* series); // All line series are derived from QXYSeries, so this works for now | ||
sauimone
|
r586 | void appendMarkers(QBarSeries* series); | ||
void appendMarkers(QPieSeries* series); | ||||
sauimone
|
r576 | void deleteMarkers(QSeries* series); | ||
sauimone
|
r637 | void layoutChanged(); | ||
sauimone
|
r565 | // <--- PIMPL | ||
sauimone
|
r626 | QPointF mPos; | ||
QSizeF mSize; | ||||
QSizeF mMinimumSize; | ||||
QSizeF mMaximumSize; | ||||
sauimone
|
r529 | QList<LegendMarker*> mMarkers; | ||
sauimone
|
r540 | |||
Michal Klocek
|
r645 | QBrush m_brush; | ||
QPen m_pen; | ||||
sauimone
|
r616 | QLegend::PreferredLayout mPreferredLayout; | ||
sauimone
|
r524 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QLEGEND_H | ||||