32 class QAbstractItemModel;
58 virtual void drawFunctions(QPaintDevice *qpd);
59 virtual void forceRepaint() = 0;
60 virtual void viewportChanged() = 0;
61 virtual int currentFunction()
const = 0;
62 virtual void modelChanged() = 0;
65 void setSquares(
bool newSquare) { m_squares=newSquare; forceRepaint(); }
71 void setKeepAspectRatio(
bool ar);
77 void updateFunctions(
const QModelIndex & parent,
int start,
int end);
79 void setModel(QAbstractItemModel* f);
80 QAbstractItemModel*
model()
const {
return m_model; }
83 void setViewport(
const QRectF& vp,
bool repaint=
true);
86 void moveViewport(
const QPoint& delta);
89 void setXAxisLabel(
const QString &label);
90 void setYAxisLabel(
const QString &label);
92 void updateGridColor(
const QColor &color) { m_gridColor = color; forceRepaint(); }
93 void updateTickScale(
const QString& m_tickScaleSymbol, qreal m_tickScaleSymbolValue,
int m_tickScaleNumerator,
int m_tickScaleDenominator);
94 void setTicksShown(Qt::Orientations o) { m_ticksShown = o; forceRepaint(); }
95 void setAxesShown(Qt::Orientations o) { m_axesShown = o; forceRepaint(); }
97 Qt::Orientations
ticksShown()
const {
return m_ticksShown; }
102 void updateScale(
bool repaint);
104 QPointF toWidget(
const QPointF &)
const;
105 QPointF fromWidget(
const QPoint& p)
const;
106 QPointF toViewport(
const QPoint& mv)
const;
107 QPair<QPointF, QString> calcImage(
const QPointF& ndp)
const;
108 QLineF slope(
const QPointF& dp)
const;
110 QLineF toWidget(
const QLineF &)
const;
111 void setPaintedSize(
const QSize& size);
112 void scaleViewport(qreal s,
const QPoint& center);
116 void drawPolarGrid(QPainter* painter,
const GridInfo& inc)
const;
117 void drawCartesianGrid(QPainter *f,
const GridInfo& inc)
const;
118 void drawMainAxes(QPainter* painter)
const;
119 GridInfo drawTicks(QPainter* painter)
const;
121 int width()
const {
return m_size.width(); }
122 int height()
const {
return m_size.height(); }
124 double rang_x, rang_y;
131 QAbstractItemModel* m_model;
133 static const QColor m_axeColor;
134 static const QColor m_derivativeColor;
136 QString m_tickScaleSymbol;
137 qreal m_tickScaleSymbolValue;
138 int m_tickScaleNumerator;
139 int m_tickScaleDenominator;
140 Qt::Orientations m_ticksShown;
141 Qt::Orientations m_axesShown;
142 QString m_axisXLabel;
143 QString m_axisYLabel;
150 #endif // PLOTTER2D_H
void setSquares(bool newSquare)
Sets whether we will see a grid or only the axes.
Represents a visual item.
bool keepAspectRatio() const
Sets whether it is keeping the aspect ratio (1:1 grid).
Qt::Orientations ticksShown() const
void setAxesShown(Qt::Orientations o)
QAbstractItemModel * model() const
void updateGridColor(const QColor &color)
QRectF lastUserViewport() const
QRectF lastViewport() const
#define ANALITZAPLOT_EXPORT
bool squares() const
Returns whether we have chosen to see the grid.
void setTicksShown(Qt::Orientations o)