legendmarker_p.h
134 lines
| 3.5 KiB
| text/x-c
|
CLexer
|
r794 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** All rights reserved. | ||||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r1366 | // W A R N I N G | ||
// ------------- | ||||
// | ||||
// This file is not part of the QtCommercial Chart API. It exists purely as an | ||||
// implementation detail. This header file may change from version to | ||||
// version without notice, or even be removed. | ||||
// | ||||
// We mean it. | ||||
|
r547 | #ifndef LEGENDMARKER_P_H | ||
#define LEGENDMARKER_P_H | ||||
#include "qchartglobal.h" | ||||
#include <QGraphicsObject> | ||||
#include <QBrush> | ||||
|
r724 | #include <QPen> | ||
|
r626 | #include <QGraphicsSimpleTextItem> | ||
|
r547 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r988 | class QAbstractSeries; | ||
|
r855 | class QAreaSeries; | ||
class QXYSeries; | ||||
|
r565 | class QBarSet; | ||
|
r855 | class QBarSeries; | ||
|
r565 | class QPieSlice; | ||
|
r855 | class QLegend; | ||
class QPieSeries; | ||||
|
r547 | |||
class LegendMarker : public QGraphicsObject | ||||
{ | ||||
Q_OBJECT | ||||
|
r565 | |||
|
r547 | public: | ||
|
r988 | explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent); | ||
|
r565 | |||
|
r766 | void setPen(const QPen &pen); | ||
|
r724 | QPen pen() const; | ||
|
r766 | void setBrush(const QBrush &brush); | ||
|
r565 | QBrush brush() const; | ||
|
r855 | void setSize(const QSize& size); | ||
|
r547 | |||
|
r855 | void setLabel(const QString label); | ||
QString label() const; | ||||
|
r988 | QAbstractSeries *series() const { return m_series;} | ||
|
r576 | |||
|
r547 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||
QRectF boundingRect() const; | ||||
|
r855 | void updateLayout(); | ||
|
r626 | |||
|
r855 | protected: | ||
|
r547 | // From QGraphicsObject | ||
void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||||
|
r587 | public Q_SLOTS: | ||
|
r855 | virtual void updated() = 0; | ||
|
r587 | |||
|
r855 | protected: | ||
|
r988 | QAbstractSeries *m_series; | ||
|
r855 | QRectF m_markerRect; | ||
|
r778 | QRectF m_boundingRect; | ||
|
r855 | QLegend* m_legend; | ||
QGraphicsSimpleTextItem *m_textItem; | ||||
QGraphicsRectItem *m_rectItem; | ||||
|
r778 | |||
|
r855 | }; | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
class XYLegendMarker : public LegendMarker | ||||
{ | ||||
public: | ||||
XYLegendMarker(QXYSeries *series, QLegend *legend); | ||||
protected: | ||||
void updated(); | ||||
private: | ||||
QXYSeries *m_series; | ||||
}; | ||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
class AreaLegendMarker : public LegendMarker | ||||
{ | ||||
public: | ||||
AreaLegendMarker(QAreaSeries *series, QLegend *legend); | ||||
protected: | ||||
void updated(); | ||||
private: | ||||
QAreaSeries *m_series; | ||||
}; | ||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
class BarLegendMarker : public LegendMarker | ||||
{ | ||||
public: | ||||
|
r953 | BarLegendMarker(QBarSeries *barseries, QBarSet *barset,QLegend *legend); | ||
|
r855 | protected: | ||
void updated(); | ||||
private: | ||||
|
r778 | QBarSet *m_barset; | ||
|
r855 | }; | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
class PieLegendMarker : public LegendMarker | ||||
{ | ||||
public: | ||||
PieLegendMarker(QPieSeries *pieSeries, QPieSlice *pieslice, QLegend *legend); | ||||
protected: | ||||
void updated(); | ||||
private: | ||||
|
r778 | QPieSlice *m_pieslice; | ||
|
r547 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // LEGENDMARKER_P_H | ||||