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

QwtMarker Class Reference

A class for drawing markers. More...

#include <qwt_marker.h>

Inheritance diagram for QwtMarker:

QwtPlotMarker List of all members.

Public Types

enum  LineStyle { NoLine, HLine, VLine, Cross }

Public Member Functions

 QwtMarker ()
virtual ~QwtMarker ()
const QwtMarkeroperator= (const QwtMarker &)
void setLineStyle (LineStyle st)
LineStyle lineStyle () const
void setSymbol (const QwtSymbol &s)
const QwtSymbolsymbol () const
void setLabel (const QString &txt)
const QString & label () const
void setLabelAlignment (int align)
int labelAlignment () const
void setLabelPen (const QPen &p)
const QPen & labelPen () const
void setLinePen (const QPen &p)
const QPen & linePen () const
void setFont (const QFont &f)
const QFont & font () const
virtual void draw (QPainter *p, int x, int y, const QRect &r)

Protected Member Functions

virtual void markerChanged ()

Private Attributes

QString d_label
QPen d_pen
QPen d_tPen
QFont d_font
QwtSymbol d_sym
int d_align
LineStyle d_style

Detailed Description

A class for drawing markers.

A marker can be a horizontal line, a vertical line, a symbol, a label or any combination of them, which can be drawn around a center point inside a bounding rectangle.

The QwtMarker::setSymbol() member assigns a symbol to the marker. The symbol is drawn at the specified point.

With QwtMarker::setLabel(), a label can be assigned to the marker. The QwtMarker::setLabelAlignment() member specifies where the label is drawn. All the Align*-constants in qwindefs.h (see Qt documentation) are valid. The interpretation of the alignment depends on the marker's line style. The alignment refers to the center point of the marker, which means, for example, that the label would be printed left above the center point if the alignment was set to AlignLeft|AlignTop.

Definition at line 40 of file qwt_marker.h.


Member Enumeration Documentation

enum QwtMarker::LineStyle
 

Line styles.

See also:
QwtMarker::setLineStyle, QwtMarker::lineStyle
Enumeration values:
NoLine 
HLine 
VLine 
Cross 

Definition at line 48 of file qwt_marker.h.

Referenced by QwtPlot::insertLineMarker(), lineStyle(), and QwtPlot::markerLineStyle().


Constructor & Destructor Documentation

QwtMarker::QwtMarker  ) 
 

Sets alignment to Qt::AlignCenter, and style to NoLine.

Definition at line 18 of file qwt_marker.cpp.

References d_align, d_style, and NoLine.

QwtMarker::~QwtMarker  )  [virtual]
 

Destructor.

Definition at line 25 of file qwt_marker.cpp.


Member Function Documentation

void QwtMarker::draw QPainter *  p,
int  x,
int  y,
const QRect &  r
[virtual]
 

Draw the marker.

Parameters:
p Painter
x X position
y Y position
r Bounding rectangle

Definition at line 54 of file qwt_marker.cpp.

References Cross, d_align, d_font, d_label, d_pen, d_style, d_sym, d_tPen, QwtSymbol::draw(), QwtPainter::drawLine(), QwtPainter::drawText(), HLine, LabelDist, NoLine, QwtSymbol::None, qwtMax, QwtSymbol::size(), QwtSymbol::style(), and VLine.

Referenced by QwtPlot::drawCanvasItems().

const QFont & QwtMarker::font  )  const
 

Returns:
the font used for the label
See also:
QwtMarker::setFont()

Definition at line 163 of file qwt_marker.cpp.

References d_font.

Referenced by QwtPlotPrintFilter::apply(), and QwtPlot::markerFont().

const QString & QwtMarker::label  )  const
 

Returns:
the label
See also:
QwtMarker::setLabel()

Definition at line 231 of file qwt_marker.cpp.

References d_label.

Referenced by QwtPlot::markerLabel().

int QwtMarker::labelAlignment  )  const
 

Returns:
the label alignment
See also:
QwtMarker::setLabelAlignment()

Definition at line 260 of file qwt_marker.cpp.

References d_align.

Referenced by QwtPlot::markerLabelAlign().

const QPen & QwtMarker::labelPen  )  const
 

Returns:
the label's pen
See also:
QwtMarker::setLabelPen()

Definition at line 306 of file qwt_marker.cpp.

References d_tPen.

Referenced by QwtPlotPrintFilter::apply(), QwtPlot::markerLabelPen(), and QwtPlotPrintFilter::reset().

const QPen & QwtMarker::linePen  )  const
 

Returns:
the line pen
See also:
QwtMarker::setLinePen()

Definition at line 283 of file qwt_marker.cpp.

References d_pen.

Referenced by QwtPlotPrintFilter::apply(), QwtPlot::markerLinePen(), and QwtPlotPrintFilter::reset().

QwtMarker::LineStyle QwtMarker::lineStyle  )  const
 

Returns:
the line style
See also:
For a description of line styles, see QwtMarker::setLineStyle()

Definition at line 188 of file qwt_marker.cpp.

References d_style, and LineStyle.

Referenced by QwtPlot::closestMarker(), and QwtPlot::markerLineStyle().

void QwtMarker::markerChanged  )  [protected, virtual]
 

Notify a change of parameters.

This virtual function is called when a marker property has been changed and redrawing is advisable. It can be reimplemented by derived classes. The default implementation does nothing.

Reimplemented in QwtPlotMarker.

Definition at line 319 of file qwt_marker.cpp.

Referenced by setFont(), setLabel(), setLabelAlignment(), setLabelPen(), setLinePen(), setLineStyle(), setSymbol(), QwtPlotMarker::setXValue(), and QwtPlotMarker::setYValue().

const QwtMarker & QwtMarker::operator= const QwtMarker m  ) 
 

Assignment operator.

Parameters:
m Marker

Definition at line 33 of file qwt_marker.cpp.

References d_align, d_font, d_label, d_pen, d_style, d_sym, and d_tPen.

void QwtMarker::setFont const QFont &  f  ) 
 

Specify the font for the label.

Parameters:
f New font
See also:
QwtMarker::font()

Definition at line 150 of file qwt_marker.cpp.

References d_font, and markerChanged().

Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setMarkerFont().

void QwtMarker::setLabel const QString &  txt  ) 
 

Set the label.

Parameters:
txt label text
See also:
QwtMarker::label()

Definition at line 218 of file qwt_marker.cpp.

References d_label, and markerChanged().

Referenced by QwtPlot::insertLineMarker(), QwtPlot::insertMarker(), and QwtPlot::setMarkerLabel().

void QwtMarker::setLabelAlignment int  align  ) 
 

Set the alignment of the label.

The alignment determines where the label is drawn relative to the marker's position.

Parameters:
align Alignment. A combination of AlignTop, AlignBottom, AlignLeft, AlignRight, AlignCenter, AlgnHCenter, AlignVCenter.
See also:
QwtMarker::labelAlignment()

Definition at line 247 of file qwt_marker.cpp.

References d_align, and markerChanged().

Referenced by QwtPlot::insertLineMarker(), and QwtPlot::setMarkerLabelAlign().

void QwtMarker::setLabelPen const QPen &  p  ) 
 

Specify a pen for the label.

Parameters:
p New pen
See also:
QwtMarker::labelPen()

Definition at line 293 of file qwt_marker.cpp.

References d_tPen, and markerChanged().

Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), QwtPlot::setMarkerLabelPen(), and QwtPlot::setMarkerPen().

void QwtMarker::setLinePen const QPen &  p  ) 
 

Specify a pen for the line.

Parameters:
p New pen
See also:
QwtMarker::linePen()

Definition at line 270 of file qwt_marker.cpp.

References d_pen, and markerChanged().

Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), QwtPlot::setMarkerLinePen(), and QwtPlot::setMarkerPen().

void QwtMarker::setLineStyle QwtMarker::LineStyle  st  ) 
 

Set the line style.

Parameters:
st Line style. Can be one of QwtMarker::NoLine, QwtMarker::HLine, QwtMarker::VLine or QwtMarker::Cross
See also:
QwtMarker::lineStyle()

Definition at line 175 of file qwt_marker.cpp.

References d_style, and markerChanged().

Referenced by QwtPlot::insertLineMarker(), and QwtPlot::setMarkerLineStyle().

void QwtMarker::setSymbol const QwtSymbol s  ) 
 

Assign a symbol.

Parameters:
s New symbol
See also:
QwtSymbol, QwtMarker::symbol()

Definition at line 198 of file qwt_marker.cpp.

References d_sym, and markerChanged().

Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(), and QwtPlot::setMarkerSymbol().

const QwtSymbol & QwtMarker::symbol  )  const
 

Returns:
the symbol
See also:
QwtMarker::setSymbol(), QwtSymbol

Definition at line 208 of file qwt_marker.cpp.

References d_sym.

Referenced by QwtPlotPrintFilter::apply(), QwtPlot::closestMarker(), QwtPlot::markerSymbol(), and QwtPlotPrintFilter::reset().


Member Data Documentation

int QwtMarker::d_align [private]
 

Definition at line 86 of file qwt_marker.h.

Referenced by draw(), labelAlignment(), operator=(), QwtMarker(), and setLabelAlignment().

QFont QwtMarker::d_font [private]
 

Definition at line 84 of file qwt_marker.h.

Referenced by draw(), font(), operator=(), and setFont().

QString QwtMarker::d_label [private]
 

Definition at line 81 of file qwt_marker.h.

Referenced by draw(), label(), operator=(), and setLabel().

QPen QwtMarker::d_pen [private]
 

Definition at line 82 of file qwt_marker.h.

Referenced by draw(), linePen(), operator=(), and setLinePen().

LineStyle QwtMarker::d_style [private]
 

Definition at line 87 of file qwt_marker.h.

Referenced by draw(), lineStyle(), operator=(), QwtMarker(), and setLineStyle().

QwtSymbol QwtMarker::d_sym [private]
 

Definition at line 85 of file qwt_marker.h.

Referenced by draw(), operator=(), setSymbol(), and symbol().

QPen QwtMarker::d_tPen [private]
 

Definition at line 83 of file qwt_marker.h.

Referenced by draw(), labelPen(), operator=(), and setLabelPen().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:48 2003 for Qwt Developer's Guide by doxygen 1.3.2