colormapchart_p.h
123 lines
| 3.2 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, | ||||
winter
|
r1 | BlackAndWhite, | ||
ReverseBlackAndWhite | ||||
winter
|
r0 | }; | ||
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(); | ||||
winter
|
r1 | private slots : | ||
void populateColorTable(); | ||||
winter
|
r0 | 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); | ||||
winter
|
r1 | void gradientTypeChanged(); | ||
winter
|
r0 | |||
private: | ||||
inline bool isEmpty(); | ||||
winter
|
r2 | void addColorBar(); | ||
winter
|
r0 | QLinearGradient createColorMapGradient(GradientType gradientType); | ||
winter
|
r1 | void changeGradient(GradientType gradientType); | ||
winter
|
r0 | |||
protected: | ||||
QColorMapSeries *m_series; | ||||
QVector<Point3D> m_points; | ||||
QRectF m_rect; | ||||
bool m_dirty; | ||||
winter
|
r1 | QVector<QRgb> *m_colorTable; | ||
GradientType m_gradientType; | ||||
winter
|
r2 | bool m_colorbar; | ||
winter
|
r0 | }; | ||
//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 | ||||