legendmarker_p.h
145 lines
| 3.9 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> | ||
|
r1534 | #include <QGraphicsLayoutItem> | ||
|
r547 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r988 | class QAbstractSeries; | ||
|
r855 | class QAreaSeries; | ||
class QXYSeries; | ||||
|
r565 | class QBarSet; | ||
|
r1584 | class QAbstractBarSeries; | ||
|
r565 | class QPieSlice; | ||
|
r855 | class QLegend; | ||
class QPieSeries; | ||||
|
r547 | |||
|
r1534 | class LegendMarker : public QGraphicsObject, public QGraphicsLayoutItem | ||
|
r547 | { | ||
Q_OBJECT | ||||
|
r1534 | Q_INTERFACES(QGraphicsLayoutItem) | ||
|
r547 | public: | ||
|
r988 | explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent); | ||
|
r565 | |||
|
r766 | void setPen(const QPen &pen); | ||
|
r724 | QPen pen() const; | ||
|
r1534 | |||
|
r766 | void setBrush(const QBrush &brush); | ||
|
r565 | QBrush brush() const; | ||
|
r1522 | void setFont(const QFont &font); | ||
QFont font() const; | ||||
|
r855 | void setLabel(const QString label); | ||
QString label() const; | ||||
|
r1534 | |||
|
r1527 | void setLabelBrush(const QBrush &brush); | ||
QBrush labelBrush() const; | ||||
|
r855 | |||
|
r988 | QAbstractSeries *series() const { return m_series;} | ||
|
r576 | |||
|
r2104 | void setGeometry(const QRectF &rect); | ||
|
r547 | |||
QRectF boundingRect() const; | ||||
|
r1534 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||
|
r2104 | QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; | ||
|
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; | ||
|
r2104 | QLegend *m_legend; | ||
|
r855 | QGraphicsSimpleTextItem *m_textItem; | ||
QGraphicsRectItem *m_rectItem; | ||||
|
r1534 | qreal m_margin; | ||
qreal m_space; | ||||
|
r1965 | QString m_text; | ||
|
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: | ||||
|
r2097 | BarLegendMarker(QAbstractBarSeries *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 | ||||