areachartitem_p.h
109 lines
| 2.8 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$ | ||||
** | ||||
****************************************************************************/ | ||||
unknown
|
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. | ||||
Michal Klocek
|
r421 | #ifndef AREACHARTITEM_H | ||
#define AREACHARTITEM_H | ||||
#include "qchartglobal.h" | ||||
#include "linechartitem_p.h" | ||||
#include <QPen> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
class QAreaSeries; | ||||
class AreaChartItem; | ||||
Michal Klocek
|
r689 | class AreaChartItem : public ChartItem | ||
Michal Klocek
|
r421 | { | ||
Q_OBJECT | ||||
public: | ||||
sauimone
|
r743 | AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter); | ||
Tero Ahola
|
r761 | ~AreaChartItem(); | ||
Michal Klocek
|
r421 | |||
//from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QPainterPath shape() const; | ||||
Jani Honkonen
|
r2104 | LineChartItem *upperLineItem() const { return m_upper; } | ||
LineChartItem *lowerLineItem() const { return m_lower; } | ||||
Michal Klocek
|
r560 | |||
Michal Klocek
|
r421 | void updatePath(); | ||
Michal Klocek
|
r571 | |||
protected: | ||||
sauimone
|
r743 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | ||
Marek Rosa
|
r2264 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | ||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | ||||
Michal Klocek
|
r571 | |||
sauimone
|
r775 | Q_SIGNALS: | ||
Marek Rosa
|
r2264 | void clicked(const QPointF &point); | ||
void hovered(const QPointF &point, bool state); | ||||
Michal Klocek
|
r571 | |||
sauimone
|
r775 | public Q_SLOTS: | ||
Michal Klocek
|
r421 | void handleUpdated(); | ||
Michal Klocek
|
r1698 | void handleDomainUpdated(); | ||
sauimone
|
r743 | void handleGeometryChanged(const QRectF &size); | ||
Michal Klocek
|
r421 | |||
private: | ||||
Jani Honkonen
|
r2104 | QAreaSeries *m_series; | ||
LineChartItem *m_upper; | ||||
LineChartItem *m_lower; | ||||
Michal Klocek
|
r439 | QPainterPath m_path; | ||
Michal Klocek
|
r421 | QRectF m_rect; | ||
QRectF m_clipRect; | ||||
Michal Klocek
|
r563 | QPen m_linePen; | ||
QPen m_pointPen; | ||||
Michal Klocek
|
r421 | QBrush m_brush; | ||
Michal Klocek
|
r563 | bool m_pointsVisible; | ||
Michal Klocek
|
r421 | }; | ||
class AreaBoundItem : public LineChartItem | ||||
{ | ||||
public: | ||||
Jani Honkonen
|
r2104 | AreaBoundItem(AreaChartItem *item, QLineSeries *lineSeries, ChartPresenter *presenter) | ||
Jani Honkonen
|
r2097 | : LineChartItem(lineSeries, 0), m_item(item) | ||
{ | ||||
Michal Klocek
|
r1241 | setPresenter(presenter); | ||
} | ||||
Tero Ahola
|
r761 | ~AreaBoundItem() {} | ||
Michal Klocek
|
r421 | |||
Jani Honkonen
|
r2104 | void updateGeometry() | ||
{ | ||||
Michal Klocek
|
r1217 | LineChartItem::updateGeometry(); | ||
Michal Klocek
|
r421 | m_item->updatePath(); | ||
} | ||||
private: | ||||
Jani Honkonen
|
r2104 | AreaChartItem *m_item; | ||
Michal Klocek
|
r421 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif | ||||