The QwtPlotGrid class can be used to draw a coordinate grid. A coordinate grid consists of major and minor vertical and horizontal gridlines. The locations of the gridlines are determined by the X and Y scale divisions which can be assigned with setXDiv() and setYDiv(). The draw() member draws the grid within a bounding rectangle.
Definition at line 34 of file qwt_plot_grid.h.
Public Member Functions | |
QwtPlotGrid () | |
virtual | ~QwtPlotGrid () |
virtual int | rtti () const |
void | enableX (bool tf) |
bool | xEnabled () const |
void | enableY (bool tf) |
bool | yEnabled () const |
void | enableXMin (bool tf) |
bool | xMinEnabled () const |
void | enableYMin (bool tf) |
bool | yMinEnabled () const |
void | setXDiv (const QwtScaleDiv &sx) |
const QwtScaleDiv & | xScaleDiv () const |
void | setYDiv (const QwtScaleDiv &sy) |
const QwtScaleDiv & | yScaleDiv () const |
void | setPen (const QPen &p) |
void | setMajPen (const QPen &p) |
const QPen & | majPen () const |
void | setMinPen (const QPen &p) |
const QPen & | minPen () const |
virtual void | draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &rect) const |
virtual void | updateScaleDiv (const QwtScaleDiv &xMap, const QwtScaleDiv &yMap) |
QwtPlotGrid::QwtPlotGrid | ( | ) | [explicit] |
Enables major grid, disables minor grid.
Definition at line 42 of file qwt_plot_grid.cpp.
References QwtPlotItem::setZ().
QwtPlotGrid::~QwtPlotGrid | ( | ) | [virtual] |
int QwtPlotGrid::rtti | ( | ) | const [virtual] |
Reimplemented from QwtPlotItem.
Definition at line 56 of file qwt_plot_grid.cpp.
void QwtPlotGrid::enableX | ( | bool | tf | ) |
Enable or disable vertical gridlines.
tf | Enable (true) or disable |
Definition at line 68 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
bool QwtPlotGrid::xEnabled | ( | ) | const |
Definition at line 289 of file qwt_plot_grid.cpp.
void QwtPlotGrid::enableY | ( | bool | tf | ) |
Enable or disable horizontal gridlines.
tf | Enable (true) or disable |
Definition at line 82 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
bool QwtPlotGrid::yEnabled | ( | ) | const |
Definition at line 307 of file qwt_plot_grid.cpp.
void QwtPlotGrid::enableXMin | ( | bool | tf | ) |
Enable or disable minor vertical gridlines.
tf | Enable (true) or disable |
Definition at line 96 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
bool QwtPlotGrid::xMinEnabled | ( | ) | const |
Definition at line 298 of file qwt_plot_grid.cpp.
void QwtPlotGrid::enableYMin | ( | bool | tf | ) |
Enable or disable minor horizontal gridlines.
tf | Enable (true) or disable |
Definition at line 110 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
bool QwtPlotGrid::yMinEnabled | ( | ) | const |
Definition at line 316 of file qwt_plot_grid.cpp.
void QwtPlotGrid::setXDiv | ( | const QwtScaleDiv & | scaleDiv | ) |
Assign an x axis scale division.
scaleDiv | Scale division |
Definition at line 125 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
Referenced by updateScaleDiv().
const QwtScaleDiv & QwtPlotGrid::xScaleDiv | ( | ) | const |
void QwtPlotGrid::setYDiv | ( | const QwtScaleDiv & | sy | ) |
Assign a y axis division.
sy | Scale division |
Definition at line 140 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
Referenced by updateScaleDiv().
const QwtScaleDiv & QwtPlotGrid::yScaleDiv | ( | ) | const |
void QwtPlotGrid::setPen | ( | const QPen & | p | ) |
Assign a pen for both major and minor gridlines.
p | Pen |
Definition at line 154 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
void QwtPlotGrid::setMajPen | ( | const QPen & | p | ) |
Assign a pen for the major gridlines.
p | Pen |
Definition at line 169 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
const QPen & QwtPlotGrid::majPen | ( | ) | const |
Definition at line 271 of file qwt_plot_grid.cpp.
void QwtPlotGrid::setMinPen | ( | const QPen & | p | ) |
Assign a pen for the minor gridlines.
p | Pen |
Definition at line 182 of file qwt_plot_grid.cpp.
References QwtPlotItem::itemChanged().
const QPen & QwtPlotGrid::minPen | ( | ) | const |
Definition at line 280 of file qwt_plot_grid.cpp.
void QwtPlotGrid::draw | ( | QPainter * | painter, | |
const QwtScaleMap & | xMap, | |||
const QwtScaleMap & | yMap, | |||
const QRect & | canvasRect | |||
) | const [virtual] |
Draw the grid.
The grid is drawn into the bounding rectangle such that gridlines begin and end at the rectangle's borders. The X and Y maps are used to map the scale divisions into the drawing region screen.
painter | Painter | |
xMap | X axis map | |
yMap | Y axis | |
canvasRect | Contents rect of the plot canvas |
Implements QwtPlotItem.
Definition at line 203 of file qwt_plot_grid.cpp.
void QwtPlotGrid::updateScaleDiv | ( | const QwtScaleDiv & | , | |
const QwtScaleDiv & | ||||
) | [virtual] |
Update the item to changes of the axes scale division.
Update the item, when the axes of plot have changed. The default implementation does nothing, but items that depend on the scale division (like QwtPlotGrid()) have to reimplement updateScaleDiv()
xScaleDiv | Scale division of the x-axis | |
yScaleDiv | Scale division of the y-axis |
Reimplemented from QwtPlotItem.
Definition at line 334 of file qwt_plot_grid.cpp.