qlegend.h
80 lines
| 2.0 KiB
| text/x-c
|
CLexer
/ src / qlegend.h
|
r524 | #ifndef QLEGEND_H | ||
#define QLEGEND_H | ||||
#include "qchartglobal.h" | ||||
#include "qseries.h" | ||||
#include <QGraphicsObject> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class Domain; | ||||
|
r529 | class LegendMarker; | ||
|
r565 | class QPieSlice; | ||
class QXYSeries; | ||||
class QBarSet; | ||||
class QBarSeries; | ||||
class QPieSeries; | ||||
|
r524 | |||
|
r529 | class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsObject | ||
|
r524 | { | ||
Q_OBJECT | ||||
public: | ||||
|
r616 | enum PreferredLayout { | ||
PreferredLayoutHorizontal, | ||||
PreferredLayoutVertical | ||||
}; | ||||
|
r524 | explicit QLegend(QGraphicsItem *parent = 0); | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||||
QRectF boundingRect() const; | ||||
|
r540 | void setBackgroundBrush(const QBrush& brush); | ||
QBrush backgroundBrush() const; | ||||
|
r616 | void setPreferredLayout(QLegend::PreferredLayout preferred); | ||
QSizeF maximumSize() const; | ||||
void setMaximumSize(const QSizeF size); | ||||
|
r582 | |||
|
r626 | void setSize(const QSizeF size); | ||
void setPos(const QPointF &pos); | ||||
|
r524 | signals: | ||
|
r547 | // for interactions. | ||
|
r567 | void clicked(QSeries* series, Qt::MouseButton button); | ||
void clicked(QBarSet* barset, Qt::MouseButton button); | ||||
void clicked(QPieSlice* slice, Qt::MouseButton button); | ||||
|
r547 | |||
|
r524 | public slots: | ||
void handleSeriesAdded(QSeries* series,Domain* domain); | ||||
void handleSeriesRemoved(QSeries* series); | ||||
private: | ||||
|
r565 | // PIMPL ---> | ||
|
r586 | void createMarkers(QSeries* series); | ||
|
r626 | void appendMarkers(QXYSeries* series); // All line series are derived from QXYSeries, so this works for now | ||
|
r586 | void appendMarkers(QBarSeries* series); | ||
void appendMarkers(QPieSeries* series); | ||||
|
r576 | void deleteMarkers(QSeries* series); | ||
|
r616 | void layoutChanged(); // TODO: rename this to layoutChanged and remove original layoutChanged, when ready | ||
|
r565 | // <--- PIMPL | ||
|
r524 | |||
|
r626 | // QRectF mBoundingRect; | ||
QPointF mPos; | ||||
QSizeF mSize; | ||||
QSizeF mMinimumSize; | ||||
QSizeF mMaximumSize; | ||||
|
r524 | QList<QSeries*> mSeriesList; | ||
|
r529 | QList<LegendMarker*> mMarkers; | ||
|
r540 | |||
QBrush mBackgroundBrush; | ||||
|
r616 | QLegend::PreferredLayout mPreferredLayout; | ||
|
r524 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QLEGEND_H | ||||