Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# QwtGrid Class Reference

Inheritance diagram for QwtGrid:

[legend]
Collaboration diagram for QwtGrid:

[legend]
List of all members.

## Detailed Description

A class which draws a coordinate grid.

The QwtGrid 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 QwtGrid::setXDiv and QwtGrid::setYDiv() The draw() member draws the grid within a bounding rectangle.

Definition at line 32 of file qwt_grid.h.

## Public Member Functions
| QwtGrid ()
virtual | ~QwtGrid ()
virtual void | draw (QPainter *p, const QRect &r, const QwtDiMap &mx, const QwtDiMap &my) 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
## Protected Member Functions
virtual void | gridChanged ()

## Constructor & Destructor Documentation

QwtGrid::QwtGrid | ( |  | ) |

| Enables major grid, disables minor grid. Definition at line 15 of file qwt_grid.cpp.

QwtGrid::~QwtGrid | ( |  | ) | `[virtual]`

| dtor Definition at line 24 of file qwt_grid.cpp.

## Member Function Documentation

void QwtGrid::draw | ( | QPainter * | p,
|  | const QRect & | r,
|  | const QwtDiMap & | mx,
|  | const QwtDiMap & | my
| ) | 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. Parameters:
  | p | Painter
  | r | Bounding rectangle
  | mx | X axis map
  | my | Y axis
Definition at line 170 of file qwt_grid.cpp. References QwtPainter::drawLine(), QwtScaleDiv::majCnt(), QwtScaleDiv::majMark(), QwtScaleDiv::minCnt(), QwtScaleDiv::minMark(), and QwtDiMap::transform(). Referenced by QwtPlot::drawCanvasItems().

void QwtGrid::enableX | ( | bool | tf | ) |

  | Enable or disable vertical gridlines. Parameters:
  | tf | Enable (TRUE) or disable
See also: Minor gridlines can be enabled or disabled with QwtGrid::enableXMin() Definition at line 35 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::enableGridX().

void QwtGrid::enableXMin | ( | bool | tf | ) |

  | Enable or disable minor vertical gridlines. Parameters:
  | tf | Enable (TRUE) or disable
See also: QwtGrid::enableX() Definition at line 63 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::enableGridXMin().

void QwtGrid::enableY | ( | bool | tf | ) |

  | Enable or disable horizontal gridlines. Parameters:
  | tf | Enable (TRUE) or disable
See also: Minor gridlines can be enabled or disabled with QwtGrid::enableYMin() Definition at line 49 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::enableGridY().

void QwtGrid::enableYMin | ( | bool | tf | ) |

  | Enable or disable minor horizontal gridlines. Parameters:
  | tf | Enable (TRUE) or disable
See also: QwtGrid::enableY() Definition at line 77 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::enableGridYMin().

void QwtGrid::gridChanged | ( |  | ) | `[protected, virtual]`

| Notify a change of attributes. This virtual function is called when an attribute of the grid has changed. It can be redefined by derived classes. The default implementation does nothing. Reimplemented in QwtPlotGrid. Definition at line 304 of file qwt_grid.cpp. Referenced by enableX(), enableXMin(), enableY(), enableYMin(), setMajPen(), setMinPen(), setPen(), setXDiv(), and setYDiv().

const QPen & QwtGrid::majPen | ( |  | ) | const

| Returns: the pen for the major gridlines See also: QwtGrid::setMinPen, QwtGrid::setPen Definition at line 234 of file qwt_grid.cpp. Referenced by QwtPlotPrintFilter::apply(), QwtPlot::gridMajPen(), and QwtPlotPrintFilter::reset().

const QPen & QwtGrid::minPen | ( |  | ) | const

| Returns: the pen for the minor gridlines See also: QwtGrid::setMinPen, QwtGrid::setPen Definition at line 243 of file qwt_grid.cpp. Referenced by QwtPlotPrintFilter::apply(), QwtPlot::gridMinPen(), and QwtPlotPrintFilter::reset().

void QwtGrid::setMajPen | ( | const QPen & | p | ) |

  | Assign a pen for the major gridlines. Parameters:
  | p | Pen
Definition at line 136 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setGridMajPen().

void QwtGrid::setMinPen | ( | const QPen & | p | ) |

  | Assign a pen for the minor gridlines. Parameters:
  | p | Pen
Definition at line 149 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setGridMinPen().

void QwtGrid::setPen | ( | const QPen & | p | ) |

  | Assign a pen for both major and minor gridlines. Parameters:
  | p | Pen
Definition at line 122 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::setGridPen().

void QwtGrid::setXDiv | ( | const QwtScaleDiv & | sx | ) |

  | Assign an x axis scale division. Parameters:
  | sx | Scale division
Warning: QwtGrid uses implicit sharing (see Qt Manual) for the scale divisions. See also: QwtScaleDiv Definition at line 93 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::setGridXAxis(), and QwtPlot::updateAxes().

void QwtGrid::setYDiv | ( | const QwtScaleDiv & | sy | ) |

  | Assign a y axis division. Parameters:
  | sy | Scale division
Warning: QwtGrid uses implicit sharing (see Qt Manual) for the scale divisions. See also: QwtScaleDiv Definition at line 109 of file qwt_grid.cpp. References gridChanged(). Referenced by QwtPlot::setGridYAxis(), and QwtPlot::updateAxes().

bool QwtGrid::xEnabled | ( |  | ) | const

| Returns: TRUE if vertical gridlines are enabled See also: QwtGrid::enableX Definition at line 252 of file qwt_grid.cpp. Referenced by QwtPlot::gridXEnabled().

bool QwtGrid::xMinEnabled | ( |  | ) | const

| Returns: TRUE if minor vertical gridlines are enabled See also: QwtGrid::enableXMin Definition at line 261 of file qwt_grid.cpp. Referenced by QwtPlot::gridXMinEnabled().

const QwtScaleDiv & QwtGrid::xScaleDiv | ( |  | ) | const

| Returns: the scale division of the x axis Definition at line 286 of file qwt_grid.cpp.

bool QwtGrid::yEnabled | ( |  | ) | const

| Returns: TRUE if horizontal gridlines are enabled See also: QwtGrid::enableY Definition at line 270 of file qwt_grid.cpp. Referenced by QwtPlot::gridYEnabled().

bool QwtGrid::yMinEnabled | ( |  | ) | const

| Returns: TRUE if minor horizontal gridlines are enabled See also: QwtGrid::enableYMin Definition at line 279 of file qwt_grid.cpp. Referenced by QwtPlot::gridYMinEnabled().

const QwtScaleDiv & QwtGrid::yScaleDiv | ( |  | ) | const

| Returns: the scale division of the y axis Definition at line 292 of file qwt_grid.cpp.