legendmarker_p.h
125 lines
| 3.3 KiB
| text/x-c
|
CLexer
Jani Honkonen
|
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$ | ||||
** | ||||
****************************************************************************/ | ||||
sauimone
|
r547 | #ifndef LEGENDMARKER_P_H | ||
#define LEGENDMARKER_P_H | ||||
#include "qchartglobal.h" | ||||
#include <QGraphicsObject> | ||||
#include <QBrush> | ||||
sauimone
|
r724 | #include <QPen> | ||
sauimone
|
r626 | #include <QGraphicsSimpleTextItem> | ||
sauimone
|
r547 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Tero Ahola
|
r988 | class QAbstractSeries; | ||
Michal Klocek
|
r855 | class QAreaSeries; | ||
class QXYSeries; | ||||
sauimone
|
r565 | class QBarSet; | ||
Michal Klocek
|
r855 | class QBarSeries; | ||
sauimone
|
r565 | class QPieSlice; | ||
Michal Klocek
|
r855 | class QLegend; | ||
class QPieSeries; | ||||
sauimone
|
r547 | |||
class LegendMarker : public QGraphicsObject | ||||
{ | ||||
Q_OBJECT | ||||
sauimone
|
r565 | |||
sauimone
|
r547 | public: | ||
Tero Ahola
|
r988 | explicit LegendMarker(QAbstractSeries *m_series, QLegend *parent); | ||
sauimone
|
r565 | |||
sauimone
|
r766 | void setPen(const QPen &pen); | ||
sauimone
|
r724 | QPen pen() const; | ||
sauimone
|
r766 | void setBrush(const QBrush &brush); | ||
sauimone
|
r565 | QBrush brush() const; | ||
Michal Klocek
|
r855 | void setSize(const QSize& size); | ||
sauimone
|
r547 | |||
Michal Klocek
|
r855 | void setLabel(const QString label); | ||
QString label() const; | ||||
Tero Ahola
|
r988 | QAbstractSeries *series() const { return m_series;} | ||
sauimone
|
r576 | |||
sauimone
|
r547 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||
QRectF boundingRect() const; | ||||
Michal Klocek
|
r855 | void updateLayout(); | ||
sauimone
|
r626 | |||
Michal Klocek
|
r855 | protected: | ||
sauimone
|
r547 | // From QGraphicsObject | ||
void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||||
sauimone
|
r587 | public Q_SLOTS: | ||
Michal Klocek
|
r855 | virtual void updated() = 0; | ||
sauimone
|
r587 | |||
Michal Klocek
|
r855 | protected: | ||
Tero Ahola
|
r988 | QAbstractSeries *m_series; | ||
Michal Klocek
|
r855 | QRectF m_markerRect; | ||
sauimone
|
r778 | QRectF m_boundingRect; | ||
Michal Klocek
|
r855 | QLegend* m_legend; | ||
QGraphicsSimpleTextItem *m_textItem; | ||||
QGraphicsRectItem *m_rectItem; | ||||
sauimone
|
r778 | |||
Michal Klocek
|
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: | ||||
sauimone
|
r953 | BarLegendMarker(QBarSeries *barseries, QBarSet *barset,QLegend *legend); | ||
Michal Klocek
|
r855 | protected: | ||
void updated(); | ||||
private: | ||||
sauimone
|
r778 | QBarSet *m_barset; | ||
Michal Klocek
|
r855 | }; | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
class PieLegendMarker : public LegendMarker | ||||
{ | ||||
public: | ||||
PieLegendMarker(QPieSeries *pieSeries, QPieSlice *pieslice, QLegend *legend); | ||||
protected: | ||||
void updated(); | ||||
private: | ||||
sauimone
|
r778 | QPieSlice *m_pieslice; | ||
sauimone
|
r547 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // LEGENDMARKER_P_H | ||||