NAME
QwtMarker -
SYNOPSIS
Inherited by QwtPlotMarker.
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 Qt::AlignmentFlags (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 43 of file qwt_marker.h.
Public Types
enum LineStyle { NoLine, HLine, VLine, Cross }
Public Member Functions
QwtMarker ()
virtual ~QwtMarker ()
QwtMarker (const QwtMarker &)
QwtMarker & operator= (const QwtMarker &)
void setLineStyle (LineStyle st)
LineStyle lineStyle () const
void setSymbol (const QwtSymbol &s)
const QwtSymbol & symbol () const
void setLabel (const QString &text, const QFont &font=QFont(), const
QColor &color=QColor(), const QPen &pen=QPen(Qt::NoPen), const
QBrush &brush=QBrush(Qt::NoBrush))
void setLabelText (const QString &text)
const QString label () const
void setLabelAlignment (int align)
int labelAlignment () const
void setLabelColor (const QColor &c)
const QColor labelColor () 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 ()
Member Enumeration Documentation
enum QwtMarker::LineStyle
Line styles.
See also:
QwtMarker::setLineStyle, QwtMarker::lineStyle
Definition at line 51 of file qwt_marker.h.
Referenced by lineStyle().
Constructor & Destructor Documentation
QwtMarker::QwtMarker ()
Sets alignment to Qt::AlignCenter, and style to NoLine.
Definition at line 20 of file qwt_marker.cpp.
References QwtText::makeText().
QwtMarker::~QwtMarker () [virtual]
Destructor.
Definition at line 29 of file qwt_marker.cpp.
QwtMarker::QwtMarker (const QwtMarker & m)
Copy constructor.
Parameters:
m Marker
Definition at line 38 of file qwt_marker.cpp.
References QwtText::clone(), d_align, d_label, d_pen, d_style, and
d_sym.
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 72 of file qwt_marker.cpp.
References QwtText::boundingRect(), QwtText::draw(), QwtSymbol::draw(),
QwtPainter::drawLine(), QwtPainter::metricsMap(), QwtSymbol::size(),
QwtSymbol::style(), and QwtText::text().
Referenced by QwtPlot::drawCanvasItems().
const QFont QwtMarker::font () const
Returns:
the font used for the label
See also:
QwtMarker::setFont()
Definition at line 189 of file qwt_marker.cpp.
References QwtText::font().
Referenced by QwtPlotPrintFilter::apply(), and QwtPlot::markerFont().
const QString QwtMarker::label () const
Returns:
the label
See also:
QwtMarker::setLabel()
Definition at line 282 of file qwt_marker.cpp.
References QwtText::text().
Referenced by QwtPlot::markerLabel(), and setLabel().
int QwtMarker::labelAlignment () const
Returns:
the label alignment
See also:
QwtMarker::setLabelAlignment()
Definition at line 311 of file qwt_marker.cpp.
Referenced by QwtPlot::markerLabelAlign().
const QColor QwtMarker::labelColor () const
Returns:
the label’s color
See also:
QwtMarker::setLabelPen()
Definition at line 357 of file qwt_marker.cpp.
References QwtText::color().
const QPen QwtMarker::labelPen () const
Returns:
the label’s pen
See also:
QwtMarker::setLabelPen()
Warning:
This function is deprecated. Use QwtMarker::labelColor.
Definition at line 382 of file qwt_marker.cpp.
References QwtText::color().
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 334 of file qwt_marker.cpp.
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 214 of file qwt_marker.cpp.
References 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 395 of file qwt_marker.cpp.
Referenced by setFont(), setLabel(), setLabelAlignment(),
setLabelColor(), setLabelPen(), setLinePen(), setLineStyle(),
setSymbol(), QwtPlotMarker::setXValue(), and
QwtPlotMarker::setYValue().
QwtMarker & QwtMarker::operator= (const QwtMarker & m)
Assignment operator.
Parameters:
m Marker
Definition at line 51 of file qwt_marker.cpp.
References QwtText::clone(), d_align, d_label, d_pen, d_style, and
d_sym.
void QwtMarker::setFont (const QFont & f)
Specify the font for the label.
Parameters:
f New font
See also:
QwtMarker::font()
Definition at line 176 of file qwt_marker.cpp.
References QwtText::font(), markerChanged(), and QwtText::setFont().
Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(),
and QwtPlot::setMarkerFont().
void QwtMarker::setLabel (const QString & text, const QFont & font =
QFont(), const QColor & color = QColor(), const QPen & pen =
QPen(Qt::NoPen), const QBrush & brush = QBrush(Qt::NoBrush))
Set the label.
Parameters:
text Contents of the label text
font Font of the label text
color Color of the label text
pen Pen to draw the enclosing rectangle
brush Brush to draw the enclosing rectangle
See also:
QwtMarker::label()
Definition at line 259 of file qwt_marker.cpp.
References QwtText::alignment(), QwtText::color(), QwtText::font(),
label(), QwtText::makeText(), markerChanged(), QwtText::rectBrush(),
QwtText::rectPen(), and QwtText::text().
Referenced by QwtPlot::insertLineMarker(), QwtPlot::insertMarker(),
setLabelText(), 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 298 of file qwt_marker.cpp.
References markerChanged().
Referenced by QwtPlot::insertLineMarker(), and
QwtPlot::setMarkerLabelAlign().
void QwtMarker::setLabelColor (const QColor & color)
Specify a color for the label.
Parameters:
color Color of the label text
See also:
QwtMarker::labelColor()
Definition at line 344 of file qwt_marker.cpp.
References QwtText::color(), markerChanged(), and QwtText::setColor().
void QwtMarker::setLabelPen (const QPen & p)
Specify a pen for the label.
Parameters:
p New pen
See also:
QwtMarker::labelPen()
Warning:
This function is deprecated. Use QwtMarker::setLabelColor.
Definition at line 368 of file qwt_marker.cpp.
References QwtText::color(), markerChanged(), and QwtText::setColor().
Referenced by QwtPlotPrintFilter::apply(), QwtPlotPrintFilter::reset(),
QwtPlot::setMarkerLabelPen(), and QwtPlot::setMarkerPen().
void QwtMarker::setLabelText (const QString & text)
Set the label text.
Parameters:
text label text
See also:
QwtMarker::label()
Definition at line 244 of file qwt_marker.cpp.
References QwtText::color(), QwtText::font(), QwtText::rectBrush(),
QwtText::rectPen(), and setLabel().
Referenced by QwtPlot::setMarkerLabelText().
void QwtMarker::setLinePen (const QPen & p)
Specify a pen for the line.
Parameters:
p New pen
See also:
QwtMarker::linePen()
Definition at line 321 of file qwt_marker.cpp.
References 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 201 of file qwt_marker.cpp.
References 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 224 of file qwt_marker.cpp.
References 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 234 of file qwt_marker.cpp.
Referenced by QwtPlotPrintFilter::apply(), QwtPlot::closestMarker(),
QwtPlot::markerSymbol(), and QwtPlotPrintFilter::reset().
Author
Generated automatically by Doxygen for Qwt User’s Guide from the source
code.