qlegend.h
77 lines
| 1.9 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; | ||||
sauimone
|
r540 | void setBackgroundBrush(const QBrush& brush); | ||
QBrush backgroundBrush() const; | ||||
sauimone
|
r616 | void setPreferredLayout(QLegend::PreferredLayout preferred); | ||
sauimone
|
r582 | QSizeF minimumSize() const; | ||
void setMinimumSize(const QSizeF size); | ||||
sauimone
|
r616 | QSizeF maximumSize() const; | ||
void setMaximumSize(const QSizeF size); | ||||
sauimone
|
r582 | |||
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
|
r529 | void handleGeometryChanged(const QRectF& size); | ||
sauimone
|
r524 | |||
private: | ||||
sauimone
|
r565 | // PIMPL ---> | ||
sauimone
|
r586 | void createMarkers(QSeries* series); | ||
void appendMarkers(QXYSeries* series); | ||||
void appendMarkers(QBarSeries* series); | ||||
void appendMarkers(QPieSeries* series); | ||||
sauimone
|
r576 | void deleteMarkers(QSeries* series); | ||
sauimone
|
r616 | void layoutChanged(); // TODO: rename this to layoutChanged and remove original layoutChanged, when ready | ||
sauimone
|
r565 | // <--- PIMPL | ||
sauimone
|
r524 | |||
QRectF mBoundingRect; | ||||
QList<QSeries*> mSeriesList; | ||||
sauimone
|
r529 | QList<LegendMarker*> mMarkers; | ||
sauimone
|
r540 | |||
QBrush mBackgroundBrush; | ||||
sauimone
|
r582 | QSizeF mMinimumSize; | ||
sauimone
|
r616 | QSizeF mMaximumSize; | ||
QLegend::PreferredLayout mPreferredLayout; | ||||
sauimone
|
r524 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QLEGEND_H | ||||