legendmarker_p.h
94 lines
| 2.4 KiB
| text/x-c
|
CLexer
/ src / legendmarker_p.h
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 | ||||
class QSeries; | ||||
sauimone
|
r565 | class QBarSet; | ||
class QPieSlice; | ||||
sauimone
|
r547 | |||
sauimone
|
r565 | // TODO: split this to 3 different markers for series, barset and pieslice. Current implementation is easier to misuse... | ||
sauimone
|
r547 | class LegendMarker : public QGraphicsObject | ||
{ | ||||
Q_OBJECT | ||||
sauimone
|
r565 | |||
sauimone
|
r547 | public: | ||
sauimone
|
r766 | LegendMarker(QSeries *series, QGraphicsItem *parent = 0); | ||
LegendMarker(QSeries *series, QBarSet *barset, QGraphicsItem *parent = 0); | ||||
LegendMarker(QSeries *series, QPieSlice *pieslice, QGraphicsItem *parent = 0); | ||||
sauimone
|
r626 | |||
void setPos(qreal x, qreal y); | ||||
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; | ||
sauimone
|
r547 | void setName(const QString name); | ||
QString name() const; | ||||
sauimone
|
r576 | QSeries* series() const; | ||
sauimone
|
r547 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | ||
QRectF boundingRect() const; | ||||
sauimone
|
r626 | void layoutChanged(); | ||
sauimone
|
r547 | public: | ||
// From QGraphicsObject | ||||
void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||||
Q_SIGNALS: | ||||
sauimone
|
r766 | void clicked(QSeries *series, Qt::MouseButton button); | ||
void clicked(QBarSet *barset, Qt::MouseButton button); | ||||
void clicked(QPieSlice *pieslice, Qt::MouseButton button); | ||||
sauimone
|
r547 | |||
sauimone
|
r587 | public Q_SLOTS: | ||
void changed(); | ||||
sauimone
|
r547 | private: | ||
sauimone
|
r778 | QPointF m_pos; | ||
QSize m_size; | ||||
QRectF m_boundingRect; | ||||
QRectF m_markerBoundingRect; | ||||
QBrush m_brush; | ||||
QPen m_pen; | ||||
QSeries *m_series; | ||||
QBarSet *m_barset; | ||||
QPieSlice *m_pieslice; | ||||
QGraphicsSimpleTextItem *m_textItem; | ||||
sauimone
|
r585 | |||
sauimone
|
r547 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // LEGENDMARKER_P_H | ||||