##// END OF EJS Templates
more work on colorbar axis, stuck with qtchart mecanism
more work on colorbar axis, stuck with qtchart mecanism

File last commit:

r2:192d35dac363 default
r2:192d35dac363 default
Show More
colormapchart_p.h
123 lines | 3.2 KiB | text/x-c | CLexer
winter
first init : ColorMapChart added to QtCharts
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
work on color bar axis
r1 BlackAndWhite,
ReverseBlackAndWhite
winter
first init : ColorMapChart added to QtCharts
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
work on color bar axis
r1 private slots :
void populateColorTable();
winter
first init : ColorMapChart added to QtCharts
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
work on color bar axis
r1 void gradientTypeChanged();
winter
first init : ColorMapChart added to QtCharts
r0
private:
inline bool isEmpty();
winter
more work on colorbar axis, stuck with qtchart mecanism
r2 void addColorBar();
winter
first init : ColorMapChart added to QtCharts
r0 QLinearGradient createColorMapGradient(GradientType gradientType);
winter
work on color bar axis
r1 void changeGradient(GradientType gradientType);
winter
first init : ColorMapChart added to QtCharts
r0
protected:
QColorMapSeries *m_series;
QVector<Point3D> m_points;
QRectF m_rect;
bool m_dirty;
winter
work on color bar axis
r1 QVector<QRgb> *m_colorTable;
GradientType m_gradientType;
winter
more work on colorbar axis, stuck with qtchart mecanism
r2 bool m_colorbar;
winter
first init : ColorMapChart added to QtCharts
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