colormapchart_p.h
117 lines
| 3.0 KiB
| text/x-c
|
CLexer
winter
|
r0 | #ifndef COLORMAPCHART_H | ||
#define COLORMAPCHART_H | ||||
#include "point3d.h" | ||||
#include <QtCharts/QChartGlobal> | ||||
#include <private/chartitem_p.h> | ||||
#include <QtCharts/QValueAxis> | ||||
#include <QtGui/QPen> | ||||
QT_CHARTS_BEGIN_NAMESPACE | ||||
class ChartPresenter; | ||||
class QColorMapSeries; | ||||
class ColorMapChart : public ChartItem | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
enum GradientType | ||||
{ | ||||
Rainbow, | ||||
CyclingRainbow, | ||||
Grey | ||||
}; | ||||
explicit ColorMapChart(QColorMapSeries *series,QGraphicsItem *item = 0); | ||||
~ColorMapChart() {} | ||||
bool isDirty() const { return m_dirty; } | ||||
void setDirty(bool dirty); | ||||
// from QGraphicsItem | ||||
QRectF boundingRect() const; | ||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
public Q_SLOTS: | ||||
void handlePointAdded(int index); | ||||
void handlePointRemoved(int index); | ||||
void handlePointsRemoved(int index, int count); | ||||
void handlePointReplaced(int index); | ||||
void handlePointsReplaced(); | ||||
void handleDomainUpdated(); | ||||
Q_SIGNALS: | ||||
void clicked(const Point3D &point); | ||||
void hovered(const Point3D &point, bool state); | ||||
void pressed(const Point3D &point); | ||||
void released(const Point3D &point); | ||||
void doubleClicked(const Point3D &point); | ||||
private: | ||||
inline bool isEmpty(); | ||||
QLinearGradient createColorMapGradient(GradientType gradientType); | ||||
protected: | ||||
QColorMapSeries *m_series; | ||||
QVector<Point3D> m_points; | ||||
QRectF m_rect; | ||||
bool m_dirty; | ||||
QMap<int, int> *m_abscissTable; | ||||
QMap<int, int> *m_ordinateTable; | ||||
QMap<QPair<int, int>,uint> *m_coordinateToColorTable; | ||||
}; | ||||
//class PixmapMarker: public QGraphicsRectItem | ||||
//{ | ||||
//public: | ||||
// PixmapMarker(qreal x, qreal y, qreal w, qreal h, ColorMapChart *parent) | ||||
// : QGraphicsRectItem(x, y, w, h, parent), | ||||
// m_parent(parent) | ||||
// { | ||||
// setAcceptHoverEvents(true); | ||||
// setFlag(QGraphicsItem::ItemIsSelectable); | ||||
// } | ||||
//protected: | ||||
// void mousePressEvent(QGraphicsSceneMouseEvent *event) | ||||
// { | ||||
// QGraphicsRectItem::mousePressEvent(event); | ||||
// m_parent->markerPressed(this); | ||||
// m_parent->setMousePressed(); | ||||
// } | ||||
// void hoverEnterEvent(QGraphicsSceneHoverEvent *event) | ||||
// { | ||||
// QGraphicsRectItem::hoverEnterEvent(event); | ||||
// m_parent->markerHovered(this, true); | ||||
// } | ||||
// void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | ||||
// { | ||||
// QGraphicsRectItem::hoverLeaveEvent(event); | ||||
// m_parent->markerHovered(this, false); | ||||
// } | ||||
// void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | ||||
// { | ||||
// QGraphicsRectItem::mouseReleaseEvent(event); | ||||
// m_parent->markerReleased(this); | ||||
// if (m_parent->mousePressed()) | ||||
// m_parent->markerSelected(this); | ||||
// m_parent->setMousePressed(false); | ||||
// } | ||||
// void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) | ||||
// { | ||||
// QGraphicsRectItem::mouseDoubleClickEvent(event); | ||||
// m_parent->markerDoubleClicked(this); | ||||
// } | ||||
//private: | ||||
// ColorMapChart *m_parent; | ||||
//}; | ||||
QT_CHARTS_END_NAMESPACE | ||||
#endif // COLORMAPCHART_H | ||||